Skip to content

Unable to link to named constructor if class has field of same name #2276

@goderbauer

Description

@goderbauer

Example:

/// You can also use the [new Foo.bar] constructor.
class Foo {
  /// Creates with bar null.
  Foo() : bar = null;

  /// Creates with bar 1.
  Foo.bar() : bar = 1;

  /// The bar.
  final int bar;
}

The [new Foo.bar] links to the property and reports the following warning:

warning: ambiguous doc reference [new Foo.bar()] => 'dartdoc_test.Foo.bar', 'dartdoc_test.Foo.bar', from dartdoc_test.Foo: (file:///Users/goderbauer/dev/dartdoc_test/lib/dartdoc_test.dart:2:7)

I've tried some variations:

  • [new Foo.bar()] : links to property and shows the warning
  • [new Foo.bar] : links to property and shows the warning
  • [Foo.bar] : links to property, no warning (expected)
  • [Foo.bar()] : links to property and shows the warning

Metadata

Metadata

Assignees

Labels

P2A bug or feature request we're likely to work ontype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions