[XL] Change in dart/sdk[main]: Augment. Hide augmentation recovery elements from signatures

0 views
Skip to first unread message

Johnni Winther (Gerrit)

unread,
Jun 9, 2026, 6:09:56 AMJun 9
to Konstantin Shcheglov, Paul Berry, dart-...@luci-project-accounts.iam.gserviceaccount.com, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Konstantin Shcheglov and Paul Berry

Johnni Winther voted and added 1 comment

Votes added by Johnni Winther

Code-Review+1

1 comment

File pkg/analyzer/lib/src/dart/element/element.dart
Line 2535, Patchset 4 (Latest): var formalParameters = _firstFragment.formalParameters;

var hasRecoveryFragments = false;
for (var i = 0; i < formalParameters.length; i++) {
if (formalParameters[i].isOriginOtherFragmentOfEnclosing) {
hasRecoveryFragments = true;
break;
}
}

// Don't expose recovery elements as the actual executable signature.
if (hasRecoveryFragments) {
var result = <FormalParameterElementImpl>[];
for (var formalParameter in formalParameters) {
if (!formalParameter.isOriginOtherFragmentOfEnclosing) {
result.add(formalParameter.asElement2);
}
}
return result.toFixedList();
}

return List.generate(formalParameters.length, (index) {
return formalParameters[index].asElement2;
}, growable: false);
}
Johnni Winther . unresolved

Maybe add a helper for this?

Open in Gerrit

Related details

Attention is currently required from:
  • Konstantin Shcheglov
  • Paul Berry
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I455a8a18bc07cdae30006754e069d687659aab1d
Gerrit-Change-Number: 510182
Gerrit-PatchSet: 4
Gerrit-Owner: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Johnni Winther <johnni...@google.com>
Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Paul Berry <paul...@google.com>
Gerrit-Attention: Paul Berry <paul...@google.com>
Gerrit-Attention: Konstantin Shcheglov <sche...@google.com>
Gerrit-Comment-Date: Tue, 09 Jun 2026 10:09:50 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Konstantin Shcheglov (Gerrit)

unread,
Jun 9, 2026, 12:01:10 PMJun 9
to Johnni Winther, Paul Berry, dart-...@luci-project-accounts.iam.gserviceaccount.com, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Johnni Winther and Paul Berry

Konstantin Shcheglov voted and added 1 comment

Votes added by Konstantin Shcheglov

Commit-Queue+2

1 comment

File pkg/analyzer/lib/src/dart/element/element.dart
Line 2535, Patchset 4 (Latest): var formalParameters = _firstFragment.formalParameters;

var hasRecoveryFragments = false;
for (var i = 0; i < formalParameters.length; i++) {
if (formalParameters[i].isOriginOtherFragmentOfEnclosing) {
hasRecoveryFragments = true;
break;
}
}

// Don't expose recovery elements as the actual executable signature.
if (hasRecoveryFragments) {
var result = <FormalParameterElementImpl>[];
for (var formalParameter in formalParameters) {
if (!formalParameter.isOriginOtherFragmentOfEnclosing) {
result.add(formalParameter.asElement2);
}
}
return result.toFixedList();
}

return List.generate(formalParameters.length, (index) {
return formalParameters[index].asElement2;
}, growable: false);
}
Johnni Winther . unresolved

Maybe add a helper for this?

Konstantin Shcheglov

I thought about this, not here - for type parameters; but decided against it - the code is fairly easy. It does have logic, so border line. But easy, so with 2 copies is probably not worth extracting.

Open in Gerrit

Related details

Attention is currently required from:
  • Johnni Winther
  • Paul Berry
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I455a8a18bc07cdae30006754e069d687659aab1d
Gerrit-Change-Number: 510182
Gerrit-PatchSet: 4
Gerrit-Owner: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Johnni Winther <johnni...@google.com>
Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Paul Berry <paul...@google.com>
Gerrit-Attention: Paul Berry <paul...@google.com>
Gerrit-Attention: Johnni Winther <johnni...@google.com>
Gerrit-Comment-Date: Tue, 09 Jun 2026 16:01:05 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Johnni Winther <johnni...@google.com>
satisfied_requirement
open
diffy

dart-scoped@luci-project-accounts.iam.gserviceaccount.com (Gerrit)

unread,
Jun 9, 2026, 12:34:18 PMJun 9
to Konstantin Shcheglov, Johnni Winther, Paul Berry, dart-analys...@google.com, rev...@dartlang.org

dart-...@luci-project-accounts.iam.gserviceaccount.com submitted the change

Change information

Commit message:
Augment. Hide augmentation recovery elements from signatures

Do not expose recovery type parameter and formal parameter elements
through the public element model. Recovery fragments are still needed
internally to link augmentation chains with mismatched shapes, but they
should not change the effective arity or callable signature of the
declaration being augmented.

Filter fragments marked as originating from another enclosing fragment
when computing executable formal parameters, executable type parameters,
and instance type parameters. This keeps function types, class arity,
and constructor or method signatures based on the real declaration
rather than on synthetic recovery elements introduced for invalid
augmentations.
Change-Id: I455a8a18bc07cdae30006754e069d687659aab1d
Reviewed-by: Johnni Winther <johnni...@google.com>
Commit-Queue: Konstantin Shcheglov <sche...@google.com>
Files:
  • M pkg/analyzer/lib/src/dart/element/element.dart
  • M pkg/analyzer/test/src/diagnostics/augmentation_formal_parameter_test.dart
  • M pkg/analyzer/test/src/diagnostics/augmentation_type_parameter_count_test.dart
  • M pkg/analyzer/test/src/summary/elements/class_test.dart
  • M pkg/analyzer/test/src/summary/elements/enum_test.dart
  • M pkg/analyzer/test/src/summary/elements/extension_test.dart
  • M pkg/analyzer/test/src/summary/elements/extension_type_test.dart
  • M pkg/analyzer/test/src/summary/elements/mixin_test.dart
  • M pkg/analyzer/test/src/summary/elements/top_level_function_test.dart
Change size: XL
Delta: 9 files changed, 677 insertions(+), 353 deletions(-)
Branch: refs/heads/main
Submit Requirements:
  • requirement satisfiedCode-Review: +1 by Johnni Winther
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I455a8a18bc07cdae30006754e069d687659aab1d
Gerrit-Change-Number: 510182
Gerrit-PatchSet: 5
Gerrit-Owner: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Johnni Winther <johnni...@google.com>
Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Paul Berry <paul...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages