Open
Description
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
/// - [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.
typedef Record1<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.
typedef Record2<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