-
Notifications
You must be signed in to change notification settings - Fork 124
[Wildcard Variables] Dartdoc Support #3769
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
Comments
cc @srawlins This issue tracks if we need anything for Dartdoc. We probably won't, but we can cross that bridge later when we have the analyzer work done :) |
If Dartdoc is still doing its own resolution of identifier references in doc comments, then a reference of the form |
I think also type parameters, import prefixes, and maybe record type positional fields. In particular field formal parameters and super parameters should be tested. |
@kallentu I closed this too soon (I had not properly enabled wildcard variables in tests). I have a question: In dartdoc's comment resolution code, as you know, we use what analyzer gave us via it's own doc-scope resolution stuff. So now, even with the wildcard variables feature enabled, for this code: import 'dart:async' as _;
/// Text [_].
int x = 0; I see that I'm not sure how the idea of "non-binding" is implemented in the analyzer, but do you think that |
On first glance, I would assume that @pq How do go-to-definitions work for import prefixes? Does it link to something? |
Oh good point, since a prefix can be shared amongst several imports. It looks like go-to-definition currently jumps to the last import with that prefix. Maybe rename? Which seems to work even if there are multiple imports with the same prefix. |
An unrelated fix, dart-lang#3865, revealed that the wildcard-variables experiment was not actually enabled in tests; the SDK constraint used in test packages needs to be '^3.6.0'. With that fix, there are some questions about how much dartdoc should be doing to keep wildcards "non-binding" and how much the analyzer should be doing. So that is raised in dart-lang#3769 (comment).
Indeed, if I add this test case to Future<void> test_x() async {
addTestFile('''
import 'dart:async' as _;
/// Returns a [_].
String f() {
}''');
await waitForTasksFinished();
await _getNavigation(search: '[_', length: 1);
expect(regions, hasLength(1));
assertHasRegion('_]');
} it fails expecting one region (there are zero). Good. So then back to the question of test_x() async {
await assertNoErrorsInCode('''
// ignore: unused_import
import 'dart:async' as _;
/// [_]
void f() {}
''');
assertResolvedNodeText(findNode.commentReference('_]'), r'''
CommentReference
expression: SimpleIdentifier
token: _
staticElement: <null>
staticType: null
''');
} I get a passing result. I'm thinking dartdoc just doesn't have access to the latest analyzer code that puts a |
An unrelated fix, #3865, revealed that the wildcard-variables experiment was not actually enabled in tests; the SDK constraint used in test packages needs to be '^3.6.0'. With that fix, there are some questions about how much dartdoc should be doing to keep wildcards "non-binding" and how much the analyzer should be doing. So that is raised in #3769 (comment).
Well, anyways, analyzer-element-representation questions aside, dartdoc support is complete. |
This issue will track the work needed in Dartdoc for the wildcard variables feature.
There's probably no additional work needed for Dartdoc.
However, we should test that Dartdoc isn't broken by changes to how we represent wildcard variables in the analyzer.
The text was updated successfully, but these errors were encountered: