Skip to content

Mixing references of local class to the SDK class with the same name. #3891

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
isoos opened this issue Sep 28, 2024 · 2 comments · Fixed by #3912
Closed

Mixing references of local class to the SDK class with the same name. #3891

isoos opened this issue Sep 28, 2024 · 2 comments · Fixed by #3912
Assignees
Labels
P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@isoos
Copy link
Contributor

isoos commented Sep 28, 2024

package:file's documentation has multiple entries that link the (wrong) SDK API URLs, while at the same time they have the same class name in the library.
https://pub.dev/documentation/file/latest/file/file-library.html

One such example is RandomAccessFile:
https://pub.dev/documentation/file/latest/file/RandomAccessFile-class.html

even the page links to the SDK URL: https://api.dart.dev/stable/3.5.3/file/RandomAccessFile-class.html though it is the wrong one, the correct url is https://api.dart.dev/stable/3.5.3/dart-io/RandomAccessFile-class.html

@srawlins srawlins added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) P2 A bug or feature request we're likely to work on labels Oct 22, 2024
@srawlins
Copy link
Member

Thanks for catching this one! This is a result of #3838

In the model, we have one instance of the Dart SDK's RandomAccessFile class. It is exported publicly by package:file. Because of the export, we have RandomAccessFile's library as dart:io, and RandomAccessFile's canonicalLibrary as package:file/file.dart, which is maybe bad... Anyway it leads to an incorrect calculation of dirName.

@srawlins
Copy link
Member

I think it is proper to link to the remote URL (the right one, not a broken one), but also, we are generating docs for RandomAccessFile, which then would not be linked to (and are currently not linked to). So we should stop generating those docs as well...

@srawlins srawlins self-assigned this Oct 22, 2024
srawlins added a commit to srawlins/dartdoc that referenced this issue Oct 22, 2024
Fixes dart-lang#3891

In this example, the **file** package exports elements from `dart:io`. So when
`--link-to-remote` is used, the canonical library for those exported elements
should be `api.dart.dev`.

Also some cleaning:

* Move `_searchForCanonicalLibrary` from ModelElement to
  `canonicalization.dart`, keeping more canonicalization logic together.
* This allows us to make `Canonicalization` private.
* Make some comments in ModelElement doc-comments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants