@@ -5724,47 +5724,55 @@ class _WhyNotPromotedVisitor
57245724 var fieldNonPromotabilityInfo = library.fieldNameNonPromotabilityInfo;
57255725 var fieldNameInfo = fieldNonPromotabilityInfo[reason.propertyName];
57265726 var messages = < DiagnosticMessage > [];
5727- void addConflictMessage (
5728- {required Element conflictingElement,
5729- required String kind,
5730- required Element enclosingElement,
5731- required NonPromotionDocumentationLink link}) {
5727+ void addConflictMessage ({
5728+ required Element2 conflictingElement,
5729+ required String kind,
5730+ required Element2 enclosingElement,
5731+ required NonPromotionDocumentationLink link,
5732+ }) {
57325733 var enclosingKindName = enclosingElement.kind.displayName;
5733- var enclosingName = enclosingElement.name ;
5734+ var enclosingName = enclosingElement.name3 ;
57345735 var message = "'$propertyName ' couldn't be promoted because there is a "
57355736 "conflicting $kind in $enclosingKindName '$enclosingName '" ;
5736- var nonSyntheticElement = conflictingElement.nonSynthetic;
5737- messages.add (DiagnosticMessageImpl (
5738- filePath: nonSyntheticElement.source! .fullName,
5737+ var nonSyntheticElement = conflictingElement.nonSynthetic2;
5738+ var nonSyntheticFragment = nonSyntheticElement.firstFragment;
5739+ var source = nonSyntheticFragment.libraryFragment? .source;
5740+ messages.add (
5741+ DiagnosticMessageImpl (
5742+ filePath: source! .fullName,
57395743 message: message,
5740- offset: nonSyntheticElement.nameOffset,
5741- length: nonSyntheticElement.nameLength,
5742- url: link.url));
5744+ offset: nonSyntheticFragment.nameOffset2! ,
5745+ length: nonSyntheticElement.name3! .length,
5746+ url: link.url,
5747+ ),
5748+ );
57435749 }
57445750
57455751 if (fieldNameInfo != null ) {
57465752 for (var field in fieldNameInfo.conflictingFields) {
57475753 addConflictMessage (
5748- conflictingElement: field,
5749- kind: 'non-promotable field' ,
5750- enclosingElement: field.enclosingElement3 ,
5751- link:
5752- NonPromotionDocumentationLink .conflictingNonPromotableField );
5754+ conflictingElement: field,
5755+ kind: 'non-promotable field' ,
5756+ enclosingElement: field.enclosingElement2 ,
5757+ link: NonPromotionDocumentationLink .conflictingNonPromotableField,
5758+ );
57535759 }
57545760 for (var getter in fieldNameInfo.conflictingGetters) {
57555761 addConflictMessage (
5756- conflictingElement: getter,
5757- kind: 'getter' ,
5758- enclosingElement: getter.enclosingElement3,
5759- link: NonPromotionDocumentationLink .conflictingGetter);
5762+ conflictingElement: getter,
5763+ kind: 'getter' ,
5764+ enclosingElement: getter.enclosingElement2,
5765+ link: NonPromotionDocumentationLink .conflictingGetter,
5766+ );
57605767 }
57615768 for (var nsmClass in fieldNameInfo.conflictingNsmClasses) {
57625769 addConflictMessage (
5763- conflictingElement: nsmClass,
5764- kind: 'noSuchMethod forwarder' ,
5765- enclosingElement: nsmClass,
5766- link: NonPromotionDocumentationLink
5767- .conflictingNoSuchMethodForwarder);
5770+ conflictingElement: nsmClass,
5771+ kind: 'noSuchMethod forwarder' ,
5772+ enclosingElement: nsmClass,
5773+ link:
5774+ NonPromotionDocumentationLink .conflictingNoSuchMethodForwarder,
5775+ );
57685776 }
57695777 }
57705778 if (reason.fieldPromotionEnabled) {
0 commit comments