dartdoc
dartdoc copied to clipboard
Unable to link to named constructor with same name as field
Dart version: 2.19.6
This issue seems to be a reappearance of https://github.com/dart-lang/dartdoc/issues/2276.
Example:
class Min {
final int value;
Min.open(this.value);
bool get open => false;
}
Trying to use any of the following:
[new Min.open(value)]: does not resolve to anything, shows "warning: unresolved doc reference"[new Min.open]: does not resolve to anything, shows "warning: unresolved doc reference", but has the correct highlighting in the IDE[Min.open]: resolves to property, no warning[Min.open(value)]: resolves to property, no warning
Sorry for the delay, I've just stumbled into this code as well. I think the current supported situation is:
[Min.open]is ambiguous between the constructor and the field. Dartdoc and the analyzer each choose the field.[new Min.open]is deprecated, both in the analyzer, and dartdoc. It refers to a non-idiomatic syntax (thenewkeyword). It's not a good solution.[Min.open()]has disambiguating parentheses, which changes the choice to the constructor. The analyzer does not support the()suffix in a doc comment reference, but I hope to remedy that ASAP. Follow https://github.com/dart-lang/sdk/issues/47553.