@@ -446,15 +446,22 @@ class _MarkdownCommentReference {
446446 // If a result is accessible in this library, prefer that.
447447 _reducePreferResultsAccessibleInSameLibrary,
448448 // This may refer to an element with the same name in multiple libraries
449- // in an external package, e.g. Matrix4 in vector_math and vector_math_64.
450- // Disambiguate by attempting to figure out which of them our package
451- // is actually using by checking the import/export graph.
449+ // in an external package, e.g. Matrix4 in vector_math and
450+ // vector_math_64. Disambiguate by attempting to figure out which of
451+ // them our package is actually using by checking the import/export
452+ // graph.
452453 _reducePreferLibrariesInLocalImportExportGraph,
453- // If a result's fully qualified name has pieces of the comment reference,
454- // prefer that.
454+ // If a result's fully qualified name has pieces of the comment
455+ // reference, prefer that.
455456 _reducePreferReferencesIncludingFullyQualifiedName,
456- // Prefer the Dart analyzer's resolution of comment references. We can't
457- // start from this because of the differences in Dartdoc canonicalization.
457+ // If the reference is indicated to be a constructor, prefer
458+ // constructors. This is not as generic as it sounds; very few naming
459+ // conflicts are allowed, but an instance field is allowed to have the
460+ // same name as a named constructor.
461+ _reducePreferConstructorViaIndicators,
462+ // Prefer the Dart analyzer's resolution of comment references. We
463+ // can't start from this because of the differences in Dartdoc
464+ // canonicalization.
458465 _reducePreferAnalyzerResolution,
459466 ]) {
460467 reduceMethod ();
@@ -497,6 +504,13 @@ class _MarkdownCommentReference {
497504 }
498505 }
499506
507+ void _reducePreferConstructorViaIndicators () {
508+ if (codeRef.contains (_constructorIndicationPattern) &&
509+ codeRefChompedParts.length >= 2 ) {
510+ results.removeWhere ((r) => r is ! Constructor );
511+ }
512+ }
513+
500514 void _reducePreferReferencesIncludingFullyQualifiedName () {
501515 var startName = '${element .fullyQualifiedName }.' ;
502516 var realName = '${element .fullyQualifiedName }.${codeRefChomped }' ;
0 commit comments