Skip to content

Record Fields & Comment References #60452

Open
@RohitSaily

Description

@RohitSaily

Dart SDK version: 3.8.0-243.0.dev (dev) (Sat Mar 29 05:02:04 2025 -0700) on "macos_x64"

Documentation comment references to record fields are not recognized. It would be useful to have them recognized. This includes the autogenerated names for positional fields e.g. $1.

Example 1 - typedef

/// [a] <- flagged as `comment_references` violation
typedef A=({int a});

/// [b] <- OK
final class B
{     final int b;
}

My conception of records is that they function like an anonymous class with final fields. I expect it to be treated that way with documentation comments in that the fields can be directly referenced through a type definition of it.

Example 2 - Record Field

/// [field.a] <- flagged as `comment_references` violation
extension type A(({int a}) field)
{}

I expect to be able to identify the record field via the extension type field.

Example 3 - Function Return Types

I got this directly from @stereotype441's issue (#59526), copying and pasting their examples here for convenience.

Example 3a

/// Returns a list of [Foo] and a list of [Bar].
///
/// [foos] is the list of [Foo] and [bars] is the list of [Bar].
({List<Foo> foos, List<Bar> bars}) getFoosAndBars();

Example 3b

/// Returns a list of [Foo] and a list of [Bar].
///
/// [$1] is the list of [Foo] and [$2] is the list of [Bar].
(List<Foo>, List<Bar>) getFoosAndBars();

All the references of their examples should be valid.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requestarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-serverIssues related to some aspect of the analysis servertype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions