You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In doc comments for typedefs that define record types, using square brackets ([ ]) to reference field names does not recognize them as in-scope identifiers. This makes it impossible to link to those fields in documentation.
This issue specifically applies to record type field names, both positional and named, when used inside a typedef.
Reproduction
/// - [a] BAD: The referenced name isn't visible in scope./// - [b] BAD: The referenced name isn't visible in scope./// - [T] GOOD: The referenced name is visible in scope.typedefRecord1<T> = (
int a,
String b,
);
/// - [a] BAD: The referenced name isn't visible in scope./// - [b] BAD: The referenced name isn't visible in scope./// - [T] GOOD: The referenced name is visible in scope.typedefRecord2<T> = ({
int a,
String b,
});
Expected behavior
The field names a and b should be treated as in-scope identifiers, and [a] and [b] should be linkable in the doc comments.
Actual behavior
[T] is correctly recognized and linkable.
[a] and [b] are not recognized, despite being valid field names in the record type alias.
Environment
Dart SDK 3.7
The text was updated successfully, but these errors were encountered:
Thinking about this a bit more, I don't think this is doable right now. I once opened Dart-Code/Dart-Code#5294 for something related to record fields but we still have #53024 opened to support renaming them. While the last one is not closed, I'm not sure this will be possible.
Note that the named getters (that is, a and b in Record2) should be in scope, in the same way as, say, instance variable declarations in a class. The names a and b in Record1 are not in scope anywhere. They are basically just comments, and it is not so obvious that they should be treated like a name which is in scope.
it is not so obvious that they should be treated like a name which is in scope.
It is probably doable to show them (both) there, but I'm not sure we should. As mentioned above, we currently don't have any internal element for them, so Go to Definition (CTRL + Click) would probably not work and even if we made it work here it would not anywhere else, currently.
I'd like your opinion here too if possible @bwilkerson.
In doc comments for
typedef
s that define record types, using square brackets ([ ]
) to reference field names does not recognize them as in-scope identifiers. This makes it impossible to link to those fields in documentation.This issue specifically applies to record type field names, both positional and named, when used inside a
typedef
.Reproduction
Expected behavior
The field names
a
andb
should be treated as in-scope identifiers, and[a]
and[b]
should be linkable in the doc comments.Actual behavior
[T]
is correctly recognized and linkable.[a]
and[b]
are not recognized, despite being valid field names in the record type alias.Environment
The text was updated successfully, but these errors were encountered: