Skip to content

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

Closed

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

Activity

  1. added
    type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)
    P2A bug or feature request we're likely to work on
    on Jul 27, 2020
  2. self-assigned this
    on Sep 3, 2020
  3. added a commit that references this issue on Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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