From b9348c7216cfaa2cfb4ad1a05d83dff87f2a6df3 Mon Sep 17 00:00:00 2001 From: Johnni Winther Date: Tue, 4 Mar 2025 01:41:05 -0800 Subject: [PATCH] [cfe] Handle patches as parts Change-Id: I50a965b8061572af8a5e408b037648b1f7ff2e0b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/413201 Reviewed-by: Chloe Stefantsova Commit-Queue: Johnni Winther --- .../lib/src/messages/codes_generated.dart | 22 ++ .../lib/src/base/incremental_compiler.dart | 7 +- pkg/front_end/lib/src/base/scope.dart | 52 ++-- pkg/front_end/lib/src/builder/builder.dart | 10 + .../lib/src/builder/class_builder.dart | 1 + .../lib/src/builder/declaration_builder.dart | 1 + .../lib/src/builder/library_builder.dart | 7 +- .../src/builder/synthesized_type_builder.dart | 4 - .../src/builder/type_parameter_builder.dart | 16 + pkg/front_end/lib/src/fragment/class.dart | 1 - .../lib/src/fragment/class/declaration.dart | 1 + .../src/fragment/constructor/declaration.dart | 1 + pkg/front_end/lib/src/fragment/enum.dart | 6 +- pkg/front_end/lib/src/fragment/extension.dart | 1 - .../lib/src/fragment/extension_type.dart | 6 +- pkg/front_end/lib/src/fragment/fragment.dart | 3 + pkg/front_end/lib/src/fragment/getter.dart | 1 + pkg/front_end/lib/src/fragment/method.dart | 18 +- pkg/front_end/lib/src/fragment/mixin.dart | 6 +- pkg/front_end/lib/src/fragment/setter.dart | 1 + pkg/front_end/lib/src/fragment/util.dart | 34 +- .../lib/src/kernel/augmentation_lowering.dart | 1 + .../lib/src/kernel/body_builder.dart | 2 + .../lib/src/kernel/body_builder_context.dart | 2 + .../lib/src/kernel/expression_generator.dart | 5 +- .../lib/src/kernel/internal_ast.dart | 10 +- .../lib/src/kernel/kernel_target.dart | 4 +- .../lib/src/source/builder_factory.dart | 71 +++-- .../lib/src/source/class_declaration.dart | 56 ++-- .../lib/src/source/diet_listener.dart | 5 +- .../lib/src/source/outline_builder.dart | 1 + .../src/source/source_builder_factory.dart | 65 +++- .../lib/src/source/source_class_builder.dart | 103 ++++-- .../src/source/source_compilation_unit.dart | 184 +++++++---- .../source/source_constructor_builder.dart | 60 +++- .../src/source/source_extension_builder.dart | 99 ++++-- ...ce_extension_type_declaration_builder.dart | 78 +++-- .../src/source/source_factory_builder.dart | 63 +++- .../src/source/source_function_builder.dart | 4 +- .../src/source/source_library_builder.dart | 58 +++- .../lib/src/source/source_loader.dart | 40 +-- .../lib/src/source/source_member_builder.dart | 2 + .../lib/src/source/source_method_builder.dart | 57 +++- .../src/source/source_property_builder.dart | 82 ++++- .../source/type_parameter_scope_builder.dart | 294 +++++++++++++----- .../src/type_inference/inference_visitor.dart | 9 +- pkg/front_end/messages.status | 2 + pkg/front_end/messages.yaml | 7 + .../test/coverage_suite_expected.dart | 84 ++--- .../test/spell_checking_list_code.txt | 1 + .../enhanced_parts/part_with_import_part.dart | 2 +- .../extensions/patch/main.dart.strong.expect | 50 ++- .../patch/main.dart.strong.modular.expect | 50 ++- .../patch/main.dart.strong.outline.expect | 27 +- .../patch/main.dart.strong.transformed.expect | 50 ++- .../extensions/patch/origin_lib.dart | 35 +++ .../testcases/extensions/patch/patch_lib.dart | 10 + .../constructor_patch/main.dart.strong.expect | 20 +- .../main.dart.strong.modular.expect | 20 +- .../main.dart.strong.outline.expect | 14 +- .../main.dart.strong.transformed.expect | 20 +- .../inject_public/main.dart.strong.expect | 68 +++- .../main.dart.strong.modular.expect | 68 +++- .../main.dart.strong.outline.expect | 78 ++++- .../main.dart.strong.transformed.expect | 68 +++- .../general/inject_public/origin_lib.dart | 6 + .../general/inject_public/patch_lib.dart | 33 +- .../issue45101/main.dart.strong.expect | 14 +- .../main.dart.strong.modular.expect | 14 +- .../main.dart.strong.outline.expect | 14 +- .../main.dart.strong.transformed.expect | 14 +- .../mixin_from_patch/main.dart.strong.expect | 12 +- .../main.dart.strong.modular.expect | 12 +- .../main.dart.strong.outline.expect | 8 +- .../main.dart.strong.transformed.expect | 12 +- .../patch_annotations/main.dart.strong.expect | 27 +- .../main.dart.strong.modular.expect | 27 +- .../main.dart.strong.outline.expect | 26 +- .../main.dart.strong.transformed.expect | 27 +- .../general/patch_annotations/patch_lib.dart | 3 - .../patch_conflict/main.dart.strong.expect | 158 ++++++---- .../main.dart.strong.modular.expect | 158 ++++++---- .../main.dart.strong.outline.expect | 153 +++++---- .../main.dart.strong.transformed.expect | 158 ++++++---- .../main.dart.strong.expect | 35 +-- .../main.dart.strong.modular.expect | 35 +-- .../main.dart.strong.outline.expect | 29 +- .../main.dart.strong.transformed.expect | 35 +-- .../main.dart.strong.expect | 166 +++++----- .../main.dart.strong.modular.expect | 166 +++++----- .../main.dart.strong.outline.expect | 78 ++--- .../main.dart.strong.transformed.expect | 166 +++++----- .../patch_prefix_access/libraries.json | 13 + .../general/patch_prefix_access/main.dart | 9 + .../main.dart.strong.expect | 52 ++++ .../main.dart.strong.modular.expect | 52 ++++ .../main.dart.strong.outline.expect | 49 +++ .../main.dart.strong.transformed.expect | 52 ++++ .../main.dart.textual_outline.expect | 3 + .../main.dart.textual_outline_modelled.expect | 3 + .../general/patch_prefix_access/main_lib.dart | 5 + .../patch_prefix_access/origin_lib.dart | 11 + .../patch_prefix_access/patch_lib.dart | 23 ++ .../patch_type_parameters/libraries.json | 13 + .../general/patch_type_parameters/main.dart | 14 + .../main.dart.strong.expect | 58 ++++ .../main.dart.strong.modular.expect | 58 ++++ .../main.dart.strong.outline.expect | 34 ++ .../main.dart.strong.transformed.expect | 58 ++++ .../main.dart.textual_outline.expect | 5 + .../main.dart.textual_outline_modelled.expect | 5 + .../patch_type_parameters/origin_lib.dart | 9 + .../patch_type_parameters/patch_lib.dart | 12 + .../testcases/general/patching/libraries.json | 13 + .../testcases/general/patching/main.dart | 33 ++ .../general/patching/main.dart.strong.expect | 238 ++++++++++++++ .../patching/main.dart.strong.modular.expect | 238 ++++++++++++++ .../patching/main.dart.strong.outline.expect | 174 +++++++++++ .../main.dart.strong.transformed.expect | 238 ++++++++++++++ .../patching/main.dart.textual_outline.expect | 3 + .../main.dart.textual_outline_modelled.expect | 3 + .../general/patching/origin_lib.dart | 49 +++ .../testcases/general/patching/patch_lib.dart | 170 ++++++++++ .../main.dart.strong.expect | 4 +- .../main.dart.strong.modular.expect | 4 +- .../main.dart.strong.outline.expect | 4 +- .../main.dart.strong.transformed.expect | 4 +- .../main.dart.strong.expect | 24 +- .../main.dart.strong.modular.expect | 24 +- .../main.dart.strong.transformed.expect | 24 +- .../libraries.json | 3 +- .../main.dart.strong.expect | 6 +- .../main.dart.strong.modular.expect | 6 +- .../main.dart.strong.outline.expect | 4 +- .../main.dart.strong.transformed.expect | 6 +- .../main.dart.strong.expect | 20 +- .../main.dart.strong.modular.expect | 20 +- .../main.dart.strong.outline.expect | 20 +- .../main.dart.strong.transformed.expect | 20 +- pkg/front_end/testcases/strong.status | 3 + 140 files changed, 4269 insertions(+), 1438 deletions(-) create mode 100644 pkg/front_end/testcases/general/patch_prefix_access/libraries.json create mode 100644 pkg/front_end/testcases/general/patch_prefix_access/main.dart create mode 100644 pkg/front_end/testcases/general/patch_prefix_access/main.dart.strong.expect create mode 100644 pkg/front_end/testcases/general/patch_prefix_access/main.dart.strong.modular.expect create mode 100644 pkg/front_end/testcases/general/patch_prefix_access/main.dart.strong.outline.expect create mode 100644 pkg/front_end/testcases/general/patch_prefix_access/main.dart.strong.transformed.expect create mode 100644 pkg/front_end/testcases/general/patch_prefix_access/main.dart.textual_outline.expect create mode 100644 pkg/front_end/testcases/general/patch_prefix_access/main.dart.textual_outline_modelled.expect create mode 100644 pkg/front_end/testcases/general/patch_prefix_access/main_lib.dart create mode 100644 pkg/front_end/testcases/general/patch_prefix_access/origin_lib.dart create mode 100644 pkg/front_end/testcases/general/patch_prefix_access/patch_lib.dart create mode 100644 pkg/front_end/testcases/general/patch_type_parameters/libraries.json create mode 100644 pkg/front_end/testcases/general/patch_type_parameters/main.dart create mode 100644 pkg/front_end/testcases/general/patch_type_parameters/main.dart.strong.expect create mode 100644 pkg/front_end/testcases/general/patch_type_parameters/main.dart.strong.modular.expect create mode 100644 pkg/front_end/testcases/general/patch_type_parameters/main.dart.strong.outline.expect create mode 100644 pkg/front_end/testcases/general/patch_type_parameters/main.dart.strong.transformed.expect create mode 100644 pkg/front_end/testcases/general/patch_type_parameters/main.dart.textual_outline.expect create mode 100644 pkg/front_end/testcases/general/patch_type_parameters/main.dart.textual_outline_modelled.expect create mode 100644 pkg/front_end/testcases/general/patch_type_parameters/origin_lib.dart create mode 100644 pkg/front_end/testcases/general/patch_type_parameters/patch_lib.dart create mode 100644 pkg/front_end/testcases/general/patching/libraries.json create mode 100644 pkg/front_end/testcases/general/patching/main.dart create mode 100644 pkg/front_end/testcases/general/patching/main.dart.strong.expect create mode 100644 pkg/front_end/testcases/general/patching/main.dart.strong.modular.expect create mode 100644 pkg/front_end/testcases/general/patching/main.dart.strong.outline.expect create mode 100644 pkg/front_end/testcases/general/patching/main.dart.strong.transformed.expect create mode 100644 pkg/front_end/testcases/general/patching/main.dart.textual_outline.expect create mode 100644 pkg/front_end/testcases/general/patching/main.dart.textual_outline_modelled.expect create mode 100644 pkg/front_end/testcases/general/patching/origin_lib.dart create mode 100644 pkg/front_end/testcases/general/patching/patch_lib.dart diff --git a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart index 7401aff4acf..7f2fb27a66b 100644 --- a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart +++ b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart @@ -15370,6 +15370,28 @@ const MessageCode messagePatchDeclarationOrigin = const MessageCode( problemMessage: r"""This is the origin declaration.""", ); +// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. +const Code codePatchExtensionOrigin = messagePatchExtensionOrigin; + +// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. +const MessageCode messagePatchExtensionOrigin = const MessageCode( + "PatchExtensionOrigin", + severity: Severity.context, + problemMessage: r"""This is the origin extension.""", +); + +// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. +const Code codePatchExtensionTypeParametersMismatch = + messagePatchExtensionTypeParametersMismatch; + +// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. +const MessageCode messagePatchExtensionTypeParametersMismatch = + const MessageCode( + "PatchExtensionTypeParametersMismatch", + problemMessage: + r"""A patch extension must have the same number of type variables as its origin extension.""", +); + // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. const Template templatePatchInjectionFailed = diff --git a/pkg/front_end/lib/src/base/incremental_compiler.dart b/pkg/front_end/lib/src/base/incremental_compiler.dart index 6824b0d966f..90f46f1f16d 100644 --- a/pkg/front_end/lib/src/base/incremental_compiler.dart +++ b/pkg/front_end/lib/src/base/incremental_compiler.dart @@ -1635,7 +1635,6 @@ class IncrementalCompiler implements IncrementalKernelGenerator { List removedLibraries = []; bool removedDillBuilders = false; for (Uri uri in potentiallyReferencedLibraries.keys) { - // Coverage-ignore-block(suite): Not run. if (uri.isScheme("package")) continue; LibraryBuilder? builder = currentKernelTarget.loader.deregisterLoadedLibraryBuilder(uri); @@ -1655,12 +1654,13 @@ class IncrementalCompiler implements IncrementalKernelGenerator { _componentProblems.removeLibrary(lib, uriTranslator, partsUsed); // Technically this isn't necessary as the uri is not a package-uri. - _incrementalSerializer?.invalidate(builder.fileUri); + _incrementalSerializer + // Coverage-ignore(suite): Not run. + ?.invalidate(builder.fileUri); } } hierarchy.applyTreeChanges(removedLibraries, const [], const []); if (removedDillBuilders) { - // Coverage-ignore-block(suite): Not run. _makeDillLoaderLibrariesUpToDateWithBuildersMap(); } @@ -1693,7 +1693,6 @@ class IncrementalCompiler implements IncrementalKernelGenerator { [Map? uriToSourceExtra, Set? partsUsed]) { uriToSource.remove(builder.fileUri); - // Coverage-ignore(suite): Not run. uriToSourceExtra?.remove(builder.fileUri); Library lib = builder.library; for (LibraryPart part in lib.parts) { diff --git a/pkg/front_end/lib/src/base/scope.dart b/pkg/front_end/lib/src/base/scope.dart index 003b2c1dea5..1a5b17760d2 100644 --- a/pkg/front_end/lib/src/base/scope.dart +++ b/pkg/front_end/lib/src/base/scope.dart @@ -1237,6 +1237,7 @@ abstract class MergedScope { SourceLibraryBuilder get originLibrary; + // Coverage-ignore(suite): Not run. void _addBuilderToMergedScope( String name, Builder newBuilder, Builder? existingBuilder, {required bool setter, required bool inPatchLibrary}) { @@ -1276,7 +1277,6 @@ abstract class MergedScope { ? templateNonPatchLibraryConflict.withArguments(name) : templateNonAugmentationLibraryConflict.withArguments(name); } else { - // Coverage-ignore-block(suite): Not run. message = inPatchLibrary ? templateNonPatchClassMemberConflict.withArguments(name) : templateNonAugmentationClassMemberConflict @@ -1312,9 +1312,7 @@ abstract class MergedScope { } else { message = inPatchLibrary ? templateUnmatchedPatchDeclaration.withArguments(name) - : - // Coverage-ignore(suite): Not run. - templateUnmatchedAugmentationDeclaration.withArguments(name); + : templateUnmatchedAugmentationDeclaration.withArguments(name); } originLibrary.addProblem( message, newBuilder.fileOffset, name.length, newBuilder.fileUri); @@ -1351,6 +1349,7 @@ abstract class MergedScope { if (augmentationMember == null) { augmentationNameSpace.addLocalMember(name, member, setter: setter); if (member is ExtensionBuilder) { + // Coverage-ignore-block(suite): Not run. augmentationNameSpace.addExtension(member); } } @@ -1364,7 +1363,9 @@ abstract class MergedScope { // `scope.forEachLocalMember`/`scope.forEachLocalSetter`. // Include all augmentation scope members to the origin scope. - nameSpace.forEachLocalMember((String name, Builder member) { + nameSpace.forEachLocalMember( + // Coverage-ignore(suite): Not run. + (String name, Builder member) { // In case of duplicates we use the first declaration. while (member.isDuplicate) { member = member.next!; @@ -1374,6 +1375,7 @@ abstract class MergedScope { setter: false, inPatchLibrary: inPatchLibrary); }); if (augmentations != null) { + // Coverage-ignore-block(suite): Not run. for (String augmentedName in augmentations.keys) { for (Builder augmentation in augmentations[augmentedName]!) { _addBuilderToMergedScope(augmentedName, augmentation, @@ -1382,7 +1384,9 @@ abstract class MergedScope { } } } - nameSpace.forEachLocalSetter((String name, Builder member) { + nameSpace.forEachLocalSetter( + // Coverage-ignore(suite): Not run. + (String name, Builder member) { // In case of duplicates we use the first declaration. while (member.isDuplicate) { member = member.next!; @@ -1392,6 +1396,7 @@ abstract class MergedScope { setter: true, inPatchLibrary: inPatchLibrary); }); if (setterAugmentations != null) { + // Coverage-ignore-block(suite): Not run. for (String augmentedName in setterAugmentations.keys) { for (Builder augmentation in setterAugmentations[augmentedName]!) { _addBuilderToMergedScope(augmentedName, augmentation, @@ -1400,7 +1405,9 @@ abstract class MergedScope { } } } - nameSpace.forEachLocalExtension((ExtensionBuilder extensionBuilder) { + nameSpace.forEachLocalExtension( + // Coverage-ignore(suite): Not run. + (ExtensionBuilder extensionBuilder) { if (extensionBuilder is SourceExtensionBuilder && extensionBuilder.isUnnamedExtension) { _originNameSpace.addExtension(extensionBuilder); @@ -1420,7 +1427,9 @@ abstract class MergedScope { _addBuilderToAugmentationNameSpace(nameSpace, name, originMember, setter: true); }); - _originNameSpace.forEachLocalExtension((ExtensionBuilder extensionBuilder) { + _originNameSpace.forEachLocalExtension( + // Coverage-ignore(suite): Not run. + (ExtensionBuilder extensionBuilder) { if (extensionBuilder is SourceExtensionBuilder && extensionBuilder.isUnnamedExtension) { nameSpace.addExtension(extensionBuilder); @@ -1433,6 +1442,7 @@ abstract class MergedScope { bool _allowInjectedPublicMember(Builder newBuilder); } +// Coverage-ignore(suite): Not run. class MergedLibraryScope extends MergedScope { MergedLibraryScope(SourceLibraryBuilder origin) : super(origin, origin.libraryNameSpace); @@ -1464,11 +1474,14 @@ class MergedClassMemberScope extends MergedScope { super(origin, origin.nameSpace); @override + // Coverage-ignore(suite): Not run. SourceLibraryBuilder get originLibrary => _origin.libraryBuilder; void _addAugmentationConstructorScope(DeclarationNameSpace nameSpace, {required bool inPatchLibrary}) { - nameSpace.forEachConstructor((String name, MemberBuilder newConstructor) { + nameSpace.forEachConstructor( + // Coverage-ignore(suite): Not run. + (String name, MemberBuilder newConstructor) { MemberBuilder? existingConstructor = _originConstructorNameSpace.lookupConstructor(name); bool isAugmentationBuilder = inPatchLibrary @@ -1483,9 +1496,7 @@ class MergedClassMemberScope extends MergedScope { inPatchLibrary ? templateNonPatchConstructorConflict .withArguments(newConstructor.fullNameForErrors) - : - // Coverage-ignore(suite): Not run. - templateNonAugmentationConstructorConflict + : templateNonAugmentationConstructorConflict .withArguments(newConstructor.fullNameForErrors), newConstructor.fileOffset, noLength, @@ -1503,9 +1514,7 @@ class MergedClassMemberScope extends MergedScope { inPatchLibrary ? templateUnmatchedPatchConstructor .withArguments(newConstructor.fullNameForErrors) - : - // Coverage-ignore(suite): Not run. - templateUnmatchedAugmentationConstructor + : templateUnmatchedAugmentationConstructor .withArguments(newConstructor.fullNameForErrors), newConstructor.fileOffset, noLength, @@ -1514,7 +1523,6 @@ class MergedClassMemberScope extends MergedScope { _originConstructorNameSpace.addConstructor(name, newConstructor); for (DeclarationNameSpace augmentationConstructorNameSpace in _augmentationConstructorNameSpaces.values) { - // Coverage-ignore-block(suite): Not run. _addConstructorToAugmentationScope( augmentationConstructorNameSpace, name, newConstructor); } @@ -1522,7 +1530,6 @@ class MergedClassMemberScope extends MergedScope { if (inPatchLibrary && !name.startsWith('_') && !_allowInjectedPublicMember(newConstructor)) { - // Coverage-ignore-block(suite): Not run. originLibrary.addProblem( templatePatchInjectionFailed.withArguments( name, originLibrary.importUri), @@ -1561,13 +1568,13 @@ class MergedClassMemberScope extends MergedScope { } @override + // Coverage-ignore(suite): Not run. bool _allowInjectedPublicMember(Builder newBuilder) { if (originLibrary.importUri.isScheme("dart") && originLibrary.importUri.path.startsWith("_")) { return true; } if (newBuilder.isStatic) { - // Coverage-ignore-block(suite): Not run. return _origin.name.startsWith('_'); } // TODO(johnniwinther): Restrict the use of injected public class members. @@ -1576,10 +1583,10 @@ class MergedClassMemberScope extends MergedScope { } extension on Builder { + // Coverage-ignore(suite): Not run. bool get isAugmentation { Builder self = this; if (self is SourceLibraryBuilder) { - // Coverage-ignore-block(suite): Not run. return self.isAugmentationLibrary; } else if (self is SourceClassBuilder) { return self.isAugmentation; @@ -1602,6 +1609,7 @@ extension on Builder { return false; } + // Coverage-ignore(suite): Not run. void set isConflictingAugmentationMember(bool value) { Builder self = this; if (self is SourceMemberBuilder) { @@ -1612,6 +1620,7 @@ extension on Builder { // TODO(johnniwinther): Handle all cases here. } + // Coverage-ignore(suite): Not run. bool _hasPatchAnnotation(Iterable? metadata) { if (metadata == null) { return false; @@ -1624,6 +1633,7 @@ extension on Builder { return false; } + // Coverage-ignore(suite): Not run. bool get hasPatchAnnotation { Builder self = this; if (self is SourceFunctionBuilder) { @@ -1636,9 +1646,7 @@ extension on Builder { return _hasPatchAnnotation(self.metadata); } else if (self is SourceMethodBuilder) { return _hasPatchAnnotation(self.metadata); - } - // Coverage-ignore(suite): Not run. - else if (self is SourceExtensionTypeDeclarationBuilder) { + } else if (self is SourceExtensionTypeDeclarationBuilder) { return _hasPatchAnnotation(self.metadata); } return false; diff --git a/pkg/front_end/lib/src/builder/builder.dart b/pkg/front_end/lib/src/builder/builder.dart index 65ab0bac22a..e6ceab33643 100644 --- a/pkg/front_end/lib/src/builder/builder.dart +++ b/pkg/front_end/lib/src/builder/builder.dart @@ -248,6 +248,10 @@ abstract class Builder { bool get isTypeParameter; + /// Adds [augmentation] to this declaration. + // TODO(johnniwinther): Remove this augmentations are based on fragments. + void addAugmentation(Builder augmentation); + /// Applies [augmentation] to this declaration. void applyAugmentation(Builder augmentation); @@ -354,6 +358,12 @@ abstract class BuilderImpl implements Builder { @override bool get isTypeParameter => false; + @override + // Coverage-ignore(suite): Not run. + void addAugmentation(Builder augmentation) { + unsupported("${runtimeType}.addAugmentation", fileOffset, fileUri); + } + @override // Coverage-ignore(suite): Not run. void applyAugmentation(Builder augmentation) { diff --git a/pkg/front_end/lib/src/builder/class_builder.dart b/pkg/front_end/lib/src/builder/class_builder.dart index 9e0a6fa374b..94749e25296 100644 --- a/pkg/front_end/lib/src/builder/class_builder.dart +++ b/pkg/front_end/lib/src/builder/class_builder.dart @@ -207,6 +207,7 @@ abstract class ClassBuilderImpl extends DeclarationBuilderImpl forStaticAccess: true); } if (declaration == null && isAugmenting) { + // Coverage-ignore-block(suite): Not run. return origin.findStaticBuilder( name, fileOffset, fileUri, accessingLibrary, isSetter: isSetter); diff --git a/pkg/front_end/lib/src/builder/declaration_builder.dart b/pkg/front_end/lib/src/builder/declaration_builder.dart index f1722b69c61..516595357ca 100644 --- a/pkg/front_end/lib/src/builder/declaration_builder.dart +++ b/pkg/front_end/lib/src/builder/declaration_builder.dart @@ -73,6 +73,7 @@ abstract class DeclarationBuilderImpl extends TypeDeclarationBuilderImpl MemberBuilder? declaration = nameSpace.lookupConstructor(name == 'new' ? '' : name); if (declaration == null && isAugmenting) { + // Coverage-ignore-block(suite): Not run. return origin.findConstructorOrFactory( name, charOffset, uri, accessingLibrary); } diff --git a/pkg/front_end/lib/src/builder/library_builder.dart b/pkg/front_end/lib/src/builder/library_builder.dart index de0d0fc9c2f..a24a406f69b 100644 --- a/pkg/front_end/lib/src/builder/library_builder.dart +++ b/pkg/front_end/lib/src/builder/library_builder.dart @@ -221,7 +221,8 @@ abstract class SourceCompilationUnit LibraryNameSpaceBuilder libraryNameSpaceBuilder, SourceCompilationUnit parentCompilationUnit, List includedParts, - Set usedParts); + Set usedParts, + {required bool allowPartInParts}); void buildOutlineExpressions( Annotatable annotatable, BodyBuilderContext bodyBuilderContext, @@ -234,6 +235,10 @@ abstract class SourceCompilationUnit Message reportFeatureNotEnabled( LibraryFeature feature, Uri fileUri, int charOffset, int length); + /// Registers that [augmentation] is a part of the library for which this is + /// the main compilation unit. + void registerAugmentation(CompilationUnit augmentation); + /// Reports [message] on all compilation units that access this compilation /// unit. void addProblemAtAccessors(Message message); diff --git a/pkg/front_end/lib/src/builder/synthesized_type_builder.dart b/pkg/front_end/lib/src/builder/synthesized_type_builder.dart index 10b90ec9209..c640767ea12 100644 --- a/pkg/front_end/lib/src/builder/synthesized_type_builder.dart +++ b/pkg/front_end/lib/src/builder/synthesized_type_builder.dart @@ -88,10 +88,6 @@ class SynthesizedTypeBuilder extends FixedTypeBuilder { DartType type = _typeBuilder.buildAliased(library, typeUse, hierarchy); Substitution substitution = _computeSubstitution(library, typeUse, hierarchy); - if ('$type'.contains('T*')) { - // Coverage-ignore-block(suite): Not run. - _typeBuilder.buildAliased(library, typeUse, hierarchy); - } return substitution.substituteType(type); } diff --git a/pkg/front_end/lib/src/builder/type_parameter_builder.dart b/pkg/front_end/lib/src/builder/type_parameter_builder.dart index 73b2ed02708..38b5b89b070 100644 --- a/pkg/front_end/lib/src/builder/type_parameter_builder.dart +++ b/pkg/front_end/lib/src/builder/type_parameter_builder.dart @@ -257,6 +257,16 @@ class NominalParameterBuilder extends TypeParameterBuilder { /// The [TypeParameter] built by this builder. TypeParameter get parameter => origin.actualParameter; + @override + // Coverage-ignore(suite): Not run. + void addAugmentation(covariant NominalParameterBuilder augmentation) { + assert( + _hasHashCode == null, + "Cannot apply augmentation since to $this since hashCode has already " + "been computed from $actualParameter @\n$_hasHashCode"); + augmentation.actualOrigin = this; + } + @override void applyAugmentation(covariant NominalParameterBuilder augmentation) { assert( @@ -723,6 +733,12 @@ class StructuralParameterBuilder extends TypeParameterBuilder { } } + @override + // Coverage-ignore(suite): Not run. + void addAugmentation(covariant StructuralParameterBuilder augmentation) { + augmentation.actualOrigin = this; + } + @override // Coverage-ignore(suite): Not run. void applyAugmentation(covariant StructuralParameterBuilder augmentation) { diff --git a/pkg/front_end/lib/src/fragment/class.dart b/pkg/front_end/lib/src/fragment/class.dart index cd19cc94d59..c699d6055bf 100644 --- a/pkg/front_end/lib/src/fragment/class.dart +++ b/pkg/front_end/lib/src/fragment/class.dart @@ -48,7 +48,6 @@ class ClassFragment extends DeclarationFragmentImpl implements Fragment { } @override - // Coverage-ignore(suite): Not run. bool get isPatch => enclosingCompilationUnit.isPatch && modifiers.isAugment; @override diff --git a/pkg/front_end/lib/src/fragment/class/declaration.dart b/pkg/front_end/lib/src/fragment/class/declaration.dart index 6d70b9f0ba7..6d867e51563 100644 --- a/pkg/front_end/lib/src/fragment/class/declaration.dart +++ b/pkg/front_end/lib/src/fragment/class/declaration.dart @@ -33,6 +33,7 @@ class RegularClassDeclaration implements ClassDeclaration { RegularClassDeclaration(this._fragment); @override + // Coverage-ignore(suite): Not run. List? get metadata => _fragment.metadata; @override diff --git a/pkg/front_end/lib/src/fragment/constructor/declaration.dart b/pkg/front_end/lib/src/fragment/constructor/declaration.dart index 862d38ffff5..d1d8fded694 100644 --- a/pkg/front_end/lib/src/fragment/constructor/declaration.dart +++ b/pkg/front_end/lib/src/fragment/constructor/declaration.dart @@ -272,6 +272,7 @@ class RegularConstructorDeclaration LookupScope get typeParameterScope => _fragment.typeParameterScope; @override + // Coverage-ignore(suite): Not run. List? get metadata => _fragment.metadata; @override diff --git a/pkg/front_end/lib/src/fragment/enum.dart b/pkg/front_end/lib/src/fragment/enum.dart index c9aed08464b..cde681dd62d 100644 --- a/pkg/front_end/lib/src/fragment/enum.dart +++ b/pkg/front_end/lib/src/fragment/enum.dart @@ -50,8 +50,10 @@ class EnumFragment extends DeclarationFragmentImpl implements Fragment { } @override - // Coverage-ignore(suite): Not run. - bool get isPatch => enclosingCompilationUnit.isPatch && modifiers.isAugment; + bool get isPatch => + enclosingCompilationUnit.isPatch && + // Coverage-ignore(suite): Not run. + modifiers.isAugment; @override void addEnumElement(EnumElementFragment fragment) { diff --git a/pkg/front_end/lib/src/fragment/extension.dart b/pkg/front_end/lib/src/fragment/extension.dart index fd44ffc70a7..37cd2cc6950 100644 --- a/pkg/front_end/lib/src/fragment/extension.dart +++ b/pkg/front_end/lib/src/fragment/extension.dart @@ -47,7 +47,6 @@ class ExtensionFragment extends DeclarationFragmentImpl implements Fragment { } @override - // Coverage-ignore(suite): Not run. bool get isPatch => enclosingCompilationUnit.isPatch && modifiers.isAugment; @override diff --git a/pkg/front_end/lib/src/fragment/extension_type.dart b/pkg/front_end/lib/src/fragment/extension_type.dart index 8f97449dd70..c006b1a29f1 100644 --- a/pkg/front_end/lib/src/fragment/extension_type.dart +++ b/pkg/front_end/lib/src/fragment/extension_type.dart @@ -48,8 +48,10 @@ class ExtensionTypeFragment extends DeclarationFragmentImpl } @override - // Coverage-ignore(suite): Not run. - bool get isPatch => enclosingCompilationUnit.isPatch && modifiers.isAugment; + bool get isPatch => + enclosingCompilationUnit.isPatch && + // Coverage-ignore(suite): Not run. + modifiers.isAugment; @override void addPrimaryConstructorField(FieldFragment fragment) { diff --git a/pkg/front_end/lib/src/fragment/fragment.dart b/pkg/front_end/lib/src/fragment/fragment.dart index 847fe7d6355..889ccacacda 100644 --- a/pkg/front_end/lib/src/fragment/fragment.dart +++ b/pkg/front_end/lib/src/fragment/fragment.dart @@ -119,4 +119,7 @@ abstract interface class LibraryFragment { abstract interface class DeclarationFragment { /// Returns `true` if this is a patch declaration. bool get isPatch; + + /// Type parameters declared on this declaration. + List? get typeParameters; } diff --git a/pkg/front_end/lib/src/fragment/getter.dart b/pkg/front_end/lib/src/fragment/getter.dart index cc5f145d84c..e3f00794ba0 100644 --- a/pkg/front_end/lib/src/fragment/getter.dart +++ b/pkg/front_end/lib/src/fragment/getter.dart @@ -935,6 +935,7 @@ class _GetterFragmentBodyBuilderContext extends BodyBuilderContext { VariableDeclaration? getTearOffParameter(int index) => null; @override + // Coverage-ignore(suite): Not run. AugmentSuperTarget? get augmentSuperTarget { if (_fragment.builder.isAugmentation) { return _fragment.builder.augmentSuperTarget; diff --git a/pkg/front_end/lib/src/fragment/method.dart b/pkg/front_end/lib/src/fragment/method.dart index b06594088ec..b888dc8967f 100644 --- a/pkg/front_end/lib/src/fragment/method.dart +++ b/pkg/front_end/lib/src/fragment/method.dart @@ -289,8 +289,13 @@ class _ExtensionInstanceMethodStrategy implements MethodEncodingStrategy { ExtensionBuilder declarationBuilder = builder.declarationBuilder as ExtensionBuilder; SynthesizedExtensionSignature signature = new SynthesizedExtensionSignature( - declarationBuilder, unboundNominalParameters, - fileUri: fragment.fileUri, fileOffset: fragment.nameOffset); + declarationBuilder: declarationBuilder, + extensionTypeParameterFragments: + fragment.enclosingDeclaration!.typeParameters, + unboundNominalParameters: unboundNominalParameters, + onTypeBuilder: declarationBuilder.onType, + fileUri: fragment.fileUri, + fileOffset: fragment.nameOffset); return fragment.isOperator ? new _ExtensionInstanceOperatorEncoding(fragment, signature.clonedDeclarationTypeParameters, signature.thisFormal) @@ -323,8 +328,12 @@ class _ExtensionTypeInstanceMethodStrategy implements MethodEncodingStrategy { builder.declarationBuilder as ExtensionTypeDeclarationBuilder; SynthesizedExtensionTypeSignature signature = new SynthesizedExtensionTypeSignature( - declarationBuilder, unboundNominalParameters, - fileUri: fragment.fileUri, fileOffset: fragment.nameOffset); + extensionTypeDeclarationBuilder: declarationBuilder, + extensionTypeTypeParameters: + fragment.enclosingDeclaration!.typeParameters, + unboundNominalParameters: unboundNominalParameters, + fileUri: fragment.fileUri, + fileOffset: fragment.nameOffset); return fragment.isOperator ? new _ExtensionTypeInstanceOperatorEncoding(fragment, signature.clonedDeclarationTypeParameters, signature.thisFormal) @@ -1314,6 +1323,7 @@ class _MethodFragmentBodyBuilderContext extends BodyBuilderContext { _fragment._encoding.getTearOffParameter(index); @override + // Coverage-ignore(suite): Not run. AugmentSuperTarget? get augmentSuperTarget { if (_fragment.builder.isAugmentation) { return _fragment.builder.augmentSuperTarget; diff --git a/pkg/front_end/lib/src/fragment/mixin.dart b/pkg/front_end/lib/src/fragment/mixin.dart index d4f61eeaeb0..2c0eff4b1dc 100644 --- a/pkg/front_end/lib/src/fragment/mixin.dart +++ b/pkg/front_end/lib/src/fragment/mixin.dart @@ -48,8 +48,10 @@ class MixinFragment extends DeclarationFragmentImpl implements Fragment { } @override - // Coverage-ignore(suite): Not run. - bool get isPatch => enclosingCompilationUnit.isPatch && modifiers.isAugment; + bool get isPatch => + enclosingCompilationUnit.isPatch && + // Coverage-ignore(suite): Not run. + modifiers.isAugment; @override // Coverage-ignore(suite): Not run. diff --git a/pkg/front_end/lib/src/fragment/setter.dart b/pkg/front_end/lib/src/fragment/setter.dart index 9390254be42..85a1037a3ac 100644 --- a/pkg/front_end/lib/src/fragment/setter.dart +++ b/pkg/front_end/lib/src/fragment/setter.dart @@ -956,6 +956,7 @@ class _SetterFragmentBodyBuilderContext extends BodyBuilderContext { VariableDeclaration? getTearOffParameter(int index) => null; @override + // Coverage-ignore(suite): Not run. AugmentSuperTarget? get augmentSuperTarget { if (_fragment.builder.isAugmentation) { return _fragment.builder.augmentSuperTarget; diff --git a/pkg/front_end/lib/src/fragment/util.dart b/pkg/front_end/lib/src/fragment/util.dart index 2ac045be5eb..902c1b69753 100644 --- a/pkg/front_end/lib/src/fragment/util.dart +++ b/pkg/front_end/lib/src/fragment/util.dart @@ -364,8 +364,13 @@ class ExtensionInstancePropertyEncodingStrategy ExtensionBuilder declarationBuilder = builder.declarationBuilder as ExtensionBuilder; SynthesizedExtensionSignature signature = new SynthesizedExtensionSignature( - declarationBuilder, unboundNominalParameters, - fileUri: fragment.fileUri, fileOffset: fragment.nameOffset); + declarationBuilder: declarationBuilder, + extensionTypeParameterFragments: + fragment.enclosingDeclaration!.typeParameters, + unboundNominalParameters: unboundNominalParameters, + onTypeBuilder: declarationBuilder.onType, + fileUri: fragment.fileUri, + fileOffset: fragment.nameOffset); return new _ExtensionInstanceGetterEncoding(fragment, signature.clonedDeclarationTypeParameters, signature.thisFormal); } @@ -378,8 +383,13 @@ class ExtensionInstancePropertyEncodingStrategy ExtensionBuilder declarationBuilder = builder.declarationBuilder as ExtensionBuilder; SynthesizedExtensionSignature signature = new SynthesizedExtensionSignature( - declarationBuilder, unboundNominalParameters, - fileUri: fragment.fileUri, fileOffset: fragment.nameOffset); + declarationBuilder: declarationBuilder, + extensionTypeParameterFragments: + fragment.enclosingDeclaration!.typeParameters, + unboundNominalParameters: unboundNominalParameters, + onTypeBuilder: declarationBuilder.onType, + fileUri: fragment.fileUri, + fileOffset: fragment.nameOffset); return new _ExtensionInstanceSetterEncoding(fragment, signature.clonedDeclarationTypeParameters, signature.thisFormal); } @@ -419,8 +429,12 @@ class ExtensionTypeInstancePropertyEncodingStrategy builder.declarationBuilder as ExtensionTypeDeclarationBuilder; SynthesizedExtensionTypeSignature signature = new SynthesizedExtensionTypeSignature( - declarationBuilder, unboundNominalParameters, - fileUri: fragment.fileUri, fileOffset: fragment.nameOffset); + extensionTypeDeclarationBuilder: declarationBuilder, + extensionTypeTypeParameters: + fragment.enclosingDeclaration!.typeParameters, + unboundNominalParameters: unboundNominalParameters, + fileUri: fragment.fileUri, + fileOffset: fragment.nameOffset); return new _ExtensionTypeInstanceGetterEncoding(fragment, signature.clonedDeclarationTypeParameters, signature.thisFormal); } @@ -434,8 +448,12 @@ class ExtensionTypeInstancePropertyEncodingStrategy builder.declarationBuilder as ExtensionTypeDeclarationBuilder; SynthesizedExtensionTypeSignature signature = new SynthesizedExtensionTypeSignature( - declarationBuilder, unboundNominalParameters, - fileUri: fragment.fileUri, fileOffset: fragment.nameOffset); + extensionTypeDeclarationBuilder: declarationBuilder, + extensionTypeTypeParameters: + fragment.enclosingDeclaration!.typeParameters, + unboundNominalParameters: unboundNominalParameters, + fileUri: fragment.fileUri, + fileOffset: fragment.nameOffset); return new _ExtensionTypeInstanceSetterEncoding(fragment, signature.clonedDeclarationTypeParameters, signature.thisFormal); } diff --git a/pkg/front_end/lib/src/kernel/augmentation_lowering.dart b/pkg/front_end/lib/src/kernel/augmentation_lowering.dart index fba484df29e..9c47a75993c 100644 --- a/pkg/front_end/lib/src/kernel/augmentation_lowering.dart +++ b/pkg/front_end/lib/src/kernel/augmentation_lowering.dart @@ -7,6 +7,7 @@ import 'package:kernel/ast.dart'; const String _augmentedNamePrefix = '_#'; const String _augmentedNameSuffix = '#augment'; +// Coverage-ignore(suite): Not run. /// Creates the synthesized name to use for the [index]th augmented /// member by the given [name] in [library]. /// diff --git a/pkg/front_end/lib/src/kernel/body_builder.dart b/pkg/front_end/lib/src/kernel/body_builder.dart index afd040a9d27..23b3769154f 100644 --- a/pkg/front_end/lib/src/kernel/body_builder.dart +++ b/pkg/front_end/lib/src/kernel/body_builder.dart @@ -3195,6 +3195,7 @@ class BodyBuilder extends StackListenerImpl bool isQualified = prefixToken != null; Builder? declaration = scope.lookupGetable(name, nameOffset, uri); if (declaration == null && prefix == null && _context.isAugmentationClass) { + // Coverage-ignore-block(suite): Not run. // The scope of an augmented method includes the origin class. declaration = _context.lookupStaticOriginMember(name, nameOffset, uri); } @@ -7228,6 +7229,7 @@ class BodyBuilder extends StackListenerImpl } @override + // Coverage-ignore(suite): Not run. void handleAugmentSuperExpression( Token augmentToken, Token superToken, IdentifierContext context) { debugEvent("AugmentSuperExpression"); diff --git a/pkg/front_end/lib/src/kernel/body_builder_context.dart b/pkg/front_end/lib/src/kernel/body_builder_context.dart index 5d3459bdfd1..34359d437ba 100644 --- a/pkg/front_end/lib/src/kernel/body_builder_context.dart +++ b/pkg/front_end/lib/src/kernel/body_builder_context.dart @@ -123,6 +123,7 @@ abstract class BodyBuilderContext { /// Returns `true` if the enclosing entity is an extension. bool get isExtensionDeclaration => _declarationContext.isExtensionDeclaration; + // Coverage-ignore(suite): Not run. /// Looks up the static member by the given [name] in the origin of the /// enclosing declaration. Builder? lookupStaticOriginMember(String name, int fileOffset, Uri fileUri) { @@ -543,6 +544,7 @@ class _SourceClassBodyBuilderDeclarationContext bool get isAugmentationClass => _sourceClassBuilder.isAugmenting; @override + // Coverage-ignore(suite): Not run. Builder? lookupStaticOriginMember(String name, int fileOffset, Uri fileUri) { // The scope of an augmented method includes the origin class. return _sourceClassBuilder.origin diff --git a/pkg/front_end/lib/src/kernel/expression_generator.dart b/pkg/front_end/lib/src/kernel/expression_generator.dart index acda2923b66..fcf3338e329 100644 --- a/pkg/front_end/lib/src/kernel/expression_generator.dart +++ b/pkg/front_end/lib/src/kernel/expression_generator.dart @@ -5058,6 +5058,7 @@ class PropertySelector extends Selector { } } +// Coverage-ignore(suite): Not run. class AugmentSuperAccessGenerator extends Generator { final AugmentSuperTarget augmentSuperTarget; @@ -5066,11 +5067,9 @@ class AugmentSuperAccessGenerator extends Generator { : super(helper, token); @override - // Coverage-ignore(suite): Not run. String get _debugName => "AugmentSuperGenerator"; @override - // Coverage-ignore(suite): Not run. String get _plainNameForRead { return unsupported("augment super.plainNameForRead", fileOffset, _uri); } @@ -5152,7 +5151,6 @@ class AugmentSuperAccessGenerator extends Generator { return buildCompoundAssignment(binaryOperator, value, offset: offset, voidContext: voidContext, isPostIncDec: true); } - // Coverage-ignore-block(suite): Not run. VariableDeclarationImpl read = _helper.createVariableDeclarationForValue(_createRead()); Expression binary = _helper.forest.createBinary(offset, @@ -5182,7 +5180,6 @@ class AugmentSuperAccessGenerator extends Generator { } @override - // Coverage-ignore(suite): Not run. void printOn(StringSink sink) { sink.write(", augmentSuperTarget: "); sink.write(augmentSuperTarget); diff --git a/pkg/front_end/lib/src/kernel/internal_ast.dart b/pkg/front_end/lib/src/kernel/internal_ast.dart index e88c9d59f90..b6d2012e8f4 100644 --- a/pkg/front_end/lib/src/kernel/internal_ast.dart +++ b/pkg/front_end/lib/src/kernel/internal_ast.dart @@ -815,9 +815,9 @@ class IntJudgment extends IntLiteral implements ExpressionJudgment { } @override + // Coverage-ignore(suite): Not run. void toTextInternal(AstPrinter printer) { if (literal == null) { - // Coverage-ignore-block(suite): Not run. printer.write('$value'); } else { printer.write(literal!); @@ -2967,6 +2967,7 @@ class PropertySet extends InternalExpression { } } +// Coverage-ignore(suite): Not run. /// An augment super invocation of the form `augment super()`. /// /// This will be transformed into an [InstanceInvocation], [InstanceGet] plus @@ -2994,17 +2995,16 @@ class AugmentSuperInvocation extends InternalExpression { } @override - // Coverage-ignore(suite): Not run. int get precedence => Precedence.PRIMARY; @override - // Coverage-ignore(suite): Not run. void toTextInternal(AstPrinter printer) { printer.write('augment super'); printer.writeArguments(arguments); } } +// Coverage-ignore(suite): Not run. /// An augment super read of the form `augment super`. /// /// This will be transformed into an [InstanceGet], [InstanceTearOff], @@ -3029,16 +3029,15 @@ class AugmentSuperGet extends InternalExpression { } @override - // Coverage-ignore(suite): Not run. int get precedence => Precedence.PRIMARY; @override - // Coverage-ignore(suite): Not run. void toTextInternal(AstPrinter printer) { printer.write('augment super'); } } +// Coverage-ignore(suite): Not run. /// An augment super write of the form `augment super = e`. /// /// This will be transformed into an [InstanceSet], or [StaticSet] after type @@ -3069,7 +3068,6 @@ class AugmentSuperSet extends InternalExpression { } @override - // Coverage-ignore(suite): Not run. void toTextInternal(AstPrinter printer) { printer.write('augment super = '); printer.writeExpression(value); diff --git a/pkg/front_end/lib/src/kernel/kernel_target.dart b/pkg/front_end/lib/src/kernel/kernel_target.dart index 5c2b46fe81a..fadace7d7b3 100644 --- a/pkg/front_end/lib/src/kernel/kernel_target.dart +++ b/pkg/front_end/lib/src/kernel/kernel_target.dart @@ -1717,12 +1717,12 @@ class KernelTarget { List? patches = uriTranslator.getDartPatches(originImportUri.path); if (patches != null) { for (Uri patch in patches) { - loader.read(patch, -1, + compilationUnit.registerAugmentation(loader.read(patch, -1, fileUri: patch, originImportUri: originImportUri, origin: compilationUnit, accessor: compilationUnit, - isPatch: true); + isPatch: true)); } } } diff --git a/pkg/front_end/lib/src/source/builder_factory.dart b/pkg/front_end/lib/src/source/builder_factory.dart index c5944a95ff7..521d6697717 100644 --- a/pkg/front_end/lib/src/source/builder_factory.dart +++ b/pkg/front_end/lib/src/source/builder_factory.dart @@ -503,10 +503,17 @@ class NominalParameterCopy { /// methods and unnamed mixin applications, and for adding copies of /// extension type parameters to extension instance methods. static NominalParameterCopy? copyTypeParameters( - List unboundNominalParameters, - List? oldParameterBuilders, - {required TypeParameterKind kind, + {required List unboundNominalParameters, + required List? oldParameterBuilders, + List? oldParameterFragments, + required TypeParameterKind kind, required InstanceTypeParameterAccessState instanceTypeParameterAccess}) { + assert( + oldParameterFragments == null || + oldParameterBuilders?.length == oldParameterFragments.length, + "Invalid type parameter fragment count. " + "Expected ${oldParameterBuilders?.length}, " + "found ${oldParameterFragments.length}."); if (oldParameterBuilders == null || oldParameterBuilders.isEmpty) { return null; } @@ -519,16 +526,20 @@ class NominalParameterCopy { List newVariableBuilders = []; - for (NominalParameterBuilder oldVariable in oldParameterBuilders) { - NominalParameterBuilder newVariable = new NominalParameterBuilder( - oldVariable.name, oldVariable.fileOffset, oldVariable.fileUri, - kind: kind, - variableVariance: oldVariable.parameter.isLegacyCovariant - ? null - : - // Coverage-ignore(suite): Not run. - oldVariable.variance, - isWildcard: oldVariable.isWildcard); + for (int index = 0; index < oldParameterBuilders.length; index++) { + NominalParameterBuilder oldVariable = oldParameterBuilders[index]; + TypeParameterFragment? oldFragment = oldParameterFragments?[index]; + Uri? fileUri = oldFragment?.fileUri ?? oldVariable.fileUri; + int fileOffset = oldFragment?.nameOffset ?? oldVariable.fileOffset; + NominalParameterBuilder newVariable = + new NominalParameterBuilder(oldVariable.name, fileOffset, fileUri, + kind: kind, + variableVariance: oldVariable.parameter.isLegacyCovariant + ? null + : + // Coverage-ignore(suite): Not run. + oldVariable.variance, + isWildcard: oldVariable.isWildcard); newVariableBuilders.add(newVariable); newToOldVariableMap[newVariable] = oldVariable; unboundNominalParameters.add(newVariable); @@ -568,21 +579,27 @@ class SynthesizedExtensionSignature { SynthesizedExtensionSignature._( this.clonedDeclarationTypeParameters, this.thisFormal); - factory SynthesizedExtensionSignature(ExtensionBuilder declarationBuilder, - List unboundNominalParameters, - {required Uri fileUri, required int fileOffset}) { + factory SynthesizedExtensionSignature( + {required ExtensionBuilder declarationBuilder, + required List? extensionTypeParameterFragments, + required TypeBuilder onTypeBuilder, + required List unboundNominalParameters, + required Uri fileUri, + required int fileOffset}) { List? clonedDeclarationTypeParameters; NominalParameterCopy? nominalVariableCopy = NominalParameterCopy.copyTypeParameters( - unboundNominalParameters, declarationBuilder.typeParameters, + unboundNominalParameters: unboundNominalParameters, + oldParameterBuilders: declarationBuilder.typeParameters, + oldParameterFragments: extensionTypeParameterFragments, kind: TypeParameterKind.extensionSynthesized, instanceTypeParameterAccess: InstanceTypeParameterAccessState.Allowed); clonedDeclarationTypeParameters = nominalVariableCopy?.newParameterBuilders; - TypeBuilder thisType = declarationBuilder.onType; + TypeBuilder thisType = onTypeBuilder; if (nominalVariableCopy != null) { thisType = nominalVariableCopy.createInContext(thisType); } @@ -611,15 +628,19 @@ class SynthesizedExtensionTypeSignature { this.clonedDeclarationTypeParameters, this.thisFormal); factory SynthesizedExtensionTypeSignature( - ExtensionTypeDeclarationBuilder declarationBuilder, - List unboundNominalParameters, - {required Uri fileUri, + {required ExtensionTypeDeclarationBuilder extensionTypeDeclarationBuilder, + required List? extensionTypeTypeParameters, + required List unboundNominalParameters, + required Uri fileUri, required int fileOffset}) { List? clonedDeclarationTypeParameters; NominalParameterCopy? nominalVariableCopy = NominalParameterCopy.copyTypeParameters( - unboundNominalParameters, declarationBuilder.typeParameters, + unboundNominalParameters: unboundNominalParameters, + oldParameterBuilders: + extensionTypeDeclarationBuilder.typeParameters, + oldParameterFragments: extensionTypeTypeParameters, kind: TypeParameterKind.extensionSynthesized, instanceTypeParameterAccess: InstanceTypeParameterAccessState.Allowed); @@ -627,10 +648,10 @@ class SynthesizedExtensionTypeSignature { clonedDeclarationTypeParameters = nominalVariableCopy?.newParameterBuilders; TypeBuilder thisType = new NamedTypeBuilderImpl.fromTypeDeclarationBuilder( - declarationBuilder, const NullabilityBuilder.omitted(), - arguments: declarationBuilder.typeParameters != null + extensionTypeDeclarationBuilder, const NullabilityBuilder.omitted(), + arguments: extensionTypeTypeParameters != null ? new List.generate( - declarationBuilder.typeParameters!.length, + extensionTypeTypeParameters.length, (int index) => new NamedTypeBuilderImpl.fromTypeDeclarationBuilder( clonedDeclarationTypeParameters![index], diff --git a/pkg/front_end/lib/src/source/class_declaration.dart b/pkg/front_end/lib/src/source/class_declaration.dart index 97e8d7b30dd..8a61f11f7aa 100644 --- a/pkg/front_end/lib/src/source/class_declaration.dart +++ b/pkg/front_end/lib/src/source/class_declaration.dart @@ -84,31 +84,47 @@ abstract class ClassDeclarationBuilder } mixin ClassDeclarationBuilderMixin implements ClassDeclarationBuilder { - List? get constructorReferences; + List get constructorReferences; + + List? get augmentations; LookupScope get bodyScope; - @override - int resolveConstructors(SourceLibraryBuilder library) { - if (constructorReferences == null) return 0; - for (ConstructorReferenceBuilder ref in constructorReferences!) { - ref.resolveIn(bodyScope, library); - } - int count = constructorReferences!.length; - if (count != 0) { - Iterator iterator = nameSpace.filteredConstructorIterator( - parent: this, includeDuplicates: true, includeAugmentations: true); - while (iterator.moveNext()) { - MemberBuilder declaration = iterator.current; - if (declaration.declarationBuilder?.origin != origin) { - unexpected("$fileUri", "${declaration.declarationBuilder!.fileUri}", - fileOffset, fileUri); - } - if (declaration is SourceFactoryBuilder) { - declaration.resolveRedirectingFactory(); - } + int resolveConstructorReferences(SourceLibraryBuilder library) { + int count = 0; + if (constructorReferences.isNotEmpty) { + for (ConstructorReferenceBuilder ref in constructorReferences) { + ref.resolveIn(bodyScope, library); } } + List? augmentations = this.augmentations; + if (augmentations != null) { + for (ClassDeclarationBuilderMixin augmentation in augmentations) { + count += augmentation.resolveConstructorReferences(library); + } + } + return count; + } + + void resolveConstructorRedirections() { + Iterator iterator = nameSpace.filteredConstructorIterator( + parent: null, includeDuplicates: true, includeAugmentations: false); + while (iterator.moveNext()) { + MemberBuilder declaration = iterator.current; + if (declaration.declarationBuilder?.origin != origin) { + unexpected("$fileUri", "${declaration.declarationBuilder!.fileUri}", + fileOffset, fileUri); + } + if (declaration is SourceFactoryBuilder) { + declaration.resolveRedirectingFactory(); + } + } + } + + @override + int resolveConstructors(SourceLibraryBuilder library) { + int count = resolveConstructorReferences(library); + resolveConstructorRedirections(); return count; } } diff --git a/pkg/front_end/lib/src/source/diet_listener.dart b/pkg/front_end/lib/src/source/diet_listener.dart index ea3ec3340ab..80a7bbfde4d 100644 --- a/pkg/front_end/lib/src/source/diet_listener.dart +++ b/pkg/front_end/lib/src/source/diet_listener.dart @@ -579,7 +579,10 @@ class DietListener extends StackListenerImpl { // Native imports must be skipped because they aren't assigned corresponding // LibraryDependency nodes. - Token importUriToken = augmentToken?.next ?? importKeyword.next!; + Token importUriToken = augmentToken + // Coverage-ignore(suite): Not run. + ?.next ?? + importKeyword.next!; String importUri = unescapeString(importUriToken.lexeme, importUriToken, this); if (importUri.startsWith("dart-ext:")) return; diff --git a/pkg/front_end/lib/src/source/outline_builder.dart b/pkg/front_end/lib/src/source/outline_builder.dart index 38b6e3f40e7..16844241328 100644 --- a/pkg/front_end/lib/src/source/outline_builder.dart +++ b/pkg/front_end/lib/src/source/outline_builder.dart @@ -718,6 +718,7 @@ class OutlineBuilder extends StackListenerImpl { } if (augmentToken != null) { + // Coverage-ignore-block(suite): Not run. if (reportIfNotEnabled(libraryFeatures.macros, augmentToken.charOffset, augmentToken.length)) { augmentToken = null; diff --git a/pkg/front_end/lib/src/source/source_builder_factory.dart b/pkg/front_end/lib/src/source/source_builder_factory.dart index efb31791810..fc9ed2d88cb 100644 --- a/pkg/front_end/lib/src/source/source_builder_factory.dart +++ b/pkg/front_end/lib/src/source/source_builder_factory.dart @@ -660,7 +660,10 @@ class BuilderFactoryImpl implements BuilderFactory, BuilderFactoryResult { isPatch: _compilationUnit.isAugmenting, referencesFromIndex: indexedLibrary, referenceIsPartOwner: indexedLibrary != null); - _parts.add(new Part(charOffset, compilationUnit)); + _parts.add(new Part( + fileUri: _compilationUnit.fileUri, + fileOffset: charOffset, + compilationUnit: compilationUnit)); // TODO(ahe): [metadata] should be stored, evaluated, and added to [part]. LibraryPart part = new LibraryPart([], uri) @@ -743,10 +746,18 @@ class BuilderFactoryImpl implements BuilderFactory, BuilderFactoryResult { } else { resolvedUri = _resolve(_compilationUnit.importUri, uri, uriOffset); compilationUnit = loader.read(resolvedUri, uriOffset, - origin: isAugmentationImport ? _augmentationRoot : null, + origin: isAugmentationImport + ? + // Coverage-ignore(suite): Not run. + _augmentationRoot + : null, accessor: _compilationUnit, isAugmentation: isAugmentationImport, - referencesFromIndex: isAugmentationImport ? indexedLibrary : null); + referencesFromIndex: isAugmentationImport + ? + // Coverage-ignore(suite): Not run. + indexedLibrary + : null); } Import import = new Import( @@ -827,6 +838,11 @@ class BuilderFactoryImpl implements BuilderFactory, BuilderFactoryResult { modifiers |= Modifiers.DeclaresConstConstructor; } + bool isPatch = + _compilationUnit.forPatchLibrary && _hasPatchAnnotation(metadata); + if (isPatch) { + modifiers |= Modifiers.Augment; + } declarationFragment.metadata = metadata; declarationFragment.modifiers = modifiers; declarationFragment.supertype = supertype; @@ -1026,6 +1042,12 @@ class BuilderFactoryImpl implements BuilderFactory, BuilderFactoryResult { _problemReporting, typeParameters?.builders, ownerName: name, allowNameConflict: false); + bool isPatch = + _compilationUnit.forPatchLibrary && _hasPatchAnnotation(metadata); + if (isPatch) { + modifiers |= Modifiers.Augment; + } + declarationFragment.metadata = metadata; declarationFragment.modifiers = modifiers; declarationFragment.onType = onType; @@ -1352,6 +1374,11 @@ class BuilderFactoryImpl implements BuilderFactory, BuilderFactoryResult { NominalParameterNameSpace typeParameterNameSpace = _nominalParameterNameSpaces.pop(); + bool isPatch = + _compilationUnit.forPatchLibrary && _hasPatchAnnotation(metadata); + if (isPatch) { + modifiers |= Modifiers.Augment; + } ConstructorFragment fragment = new ConstructorFragment( constructorName: constructorName, fileUri: _compilationUnit.fileUri, @@ -1434,6 +1461,11 @@ class BuilderFactoryImpl implements BuilderFactory, BuilderFactoryResult { NominalParameterNameSpace typeParameterNameSpace = _nominalParameterNameSpaces.pop(); + bool isPatch = + _compilationUnit.forPatchLibrary && _hasPatchAnnotation(metadata); + if (isPatch) { + modifiers |= Modifiers.Augment; + } FactoryFragment fragment = new FactoryFragment( constructorName: constructorName, fileUri: _compilationUnit.fileUri, @@ -1646,6 +1678,11 @@ class BuilderFactoryImpl implements BuilderFactory, BuilderFactoryResult { NominalParameterNameSpace typeParameterNameSpace = _nominalParameterNameSpaces.pop(); + bool isPatch = + _compilationUnit.forPatchLibrary && _hasPatchAnnotation(metadata); + if (isPatch) { + modifiers |= Modifiers.Augment; + } GetterFragment fragment = new GetterFragment( name: name, fileUri: _compilationUnit.fileUri, @@ -1713,6 +1750,11 @@ class BuilderFactoryImpl implements BuilderFactory, BuilderFactoryResult { NominalParameterNameSpace typeParameterNameSpace = _nominalParameterNameSpaces.pop(); + bool isPatch = + _compilationUnit.forPatchLibrary && _hasPatchAnnotation(metadata); + if (isPatch) { + modifiers |= Modifiers.Augment; + } SetterFragment fragment = new SetterFragment( name: name, fileUri: _compilationUnit.fileUri, @@ -1783,6 +1825,11 @@ class BuilderFactoryImpl implements BuilderFactory, BuilderFactoryResult { NominalParameterNameSpace typeParameterNameSpace = _nominalParameterNameSpaces.pop(); + bool isPatch = + _compilationUnit.forPatchLibrary && _hasPatchAnnotation(metadata); + if (isPatch) { + modifiers |= Modifiers.Augment; + } MethodFragment fragment = new MethodFragment( name: name, fileUri: _compilationUnit.fileUri, @@ -2163,3 +2210,15 @@ class BuilderFactoryImpl implements BuilderFactory, BuilderFactoryResult { @override List get libraryParts => _libraryParts; } + +bool _hasPatchAnnotation(Iterable? metadata) { + if (metadata == null) { + return false; + } + for (MetadataBuilder metadataBuilder in metadata) { + if (metadataBuilder.hasPatch) { + return true; + } + } + return false; +} diff --git a/pkg/front_end/lib/src/source/source_class_builder.dart b/pkg/front_end/lib/src/source/source_class_builder.dart index 4ff4998c239..e446511afd7 100644 --- a/pkg/front_end/lib/src/source/source_class_builder.dart +++ b/pkg/front_end/lib/src/source/source_class_builder.dart @@ -125,7 +125,7 @@ class SourceClassBuilder extends ClassBuilderImpl List? _interfaceBuilders; @override - final List? constructorReferences; + final List constructorReferences; TypeBuilder? _mixedInTypeBuilder; @@ -139,6 +139,7 @@ class SourceClassBuilder extends ClassBuilderImpl return _isConflictingAugmentationMember ??= false; } + // Coverage-ignore(suite): Not run. void set isConflictingAugmentationMember(bool value) { assert(_isConflictingAugmentationMember == null, '$this.isConflictingAugmentationMember has already been fixed.'); @@ -179,6 +180,11 @@ class SourceClassBuilder extends ClassBuilderImpl actualCls.hasConstConstructor = declaresConstConstructor; } + // TODO(johnniwinther): Remove this when augmentations are handled through + // fragments. + @override + List? get augmentations => _augmentations; + // TODO(johnniwinther): Remove this when augmentations are handled through // fragments. @override @@ -233,10 +239,17 @@ class SourceClassBuilder extends ClassBuilderImpl @override DeclarationNameSpace get nameSpace => _nameSpace; + // Coverage-ignore(suite): Not run. List? get metadata => _introductory.metadata; @override void buildScopes(LibraryBuilder coreLibrary) { + List? augmentations = _augmentations; + if (augmentations != null) { + for (SourceClassBuilder augmentation in augmentations) { + nameSpaceBuilder.includeBuilders(augmentation.nameSpaceBuilder); + } + } _nameSpace = nameSpaceBuilder.buildNameSpace( loader: libraryBuilder.loader, problemReporting: libraryBuilder, @@ -246,6 +259,12 @@ class SourceClassBuilder extends ClassBuilderImpl indexedContainer: indexedClass, containerType: ContainerType.Class, containerName: new ClassName(name)); + if (augmentations != null) { + for (SourceClassBuilder augmentation in augmentations) { + augmentation.buildScopes(coreLibrary); + _applyAugmentation(augmentation); + } + } } MergedClassMemberScope get mergedScope => _mergedScope ??= isAugmenting @@ -374,8 +393,8 @@ class SourceClassBuilder extends ClassBuilderImpl Class build(LibraryBuilder coreLibrary) { void buildBuilders(Builder declaration) { if (declaration.parent != this) { + // Coverage-ignore-block(suite): Not run. if (declaration.parent?.origin != origin) { - // Coverage-ignore-block(suite): Not run. if (fileUri != declaration.parent?.fileUri) { unexpected("$fileUri", "${declaration.parent?.fileUri}", fileOffset, fileUri); @@ -542,6 +561,14 @@ class SourceClassBuilder extends ClassBuilderImpl .filteredIterator( parent: this, includeDuplicates: false, includeAugmentations: true) .forEach(build); + + List? augmentations = _augmentations; + if (augmentations != null) { + for (SourceClassBuilder augmentation in augmentations) { + augmentation.buildOutlineExpressions( + classHierarchy, delayedDefaultValueCloners); + } + } } @override @@ -711,27 +738,15 @@ class SourceClassBuilder extends ClassBuilderImpl } @override - void applyAugmentation(Builder augmentation) { + void addAugmentation(Builder augmentation) { + _addAugmentation(augmentation); + } + + SourceClassBuilder? _addAugmentation(Builder augmentation) { if (augmentation is SourceClassBuilder) { augmentation.actualOrigin = this; (_augmentations ??= []).add(augmentation); - - mergedScope.addAugmentationScope(augmentation); - - int originLength = typeParameters?.length ?? 0; - int augmentationLength = augmentation.typeParameters?.length ?? 0; - if (originLength != augmentationLength) { - // Coverage-ignore-block(suite): Not run. - augmentation.addProblem(messagePatchClassTypeParametersMismatch, - augmentation.fileOffset, noLength, context: [ - messagePatchClassOrigin.withLocation(fileUri, fileOffset, noLength) - ]); - } else if (typeParameters != null) { - int count = 0; - for (NominalParameterBuilder t in augmentation.typeParameters!) { - typeParameters![count++].applyAugmentation(t); - } - } + return augmentation; } else { // Coverage-ignore-block(suite): Not run. libraryBuilder.addProblem(messagePatchDeclarationMismatch, @@ -739,6 +754,35 @@ class SourceClassBuilder extends ClassBuilderImpl messagePatchDeclarationOrigin.withLocation( fileUri, fileOffset, noLength) ]); + return null; + } + } + + @override + // Coverage-ignore(suite): Not run. + void applyAugmentation(Builder augmentation) { + SourceClassBuilder? classBuilder = _addAugmentation(augmentation); + if (classBuilder != null) { + _applyAugmentation(classBuilder); + } + } + + void _applyAugmentation(SourceClassBuilder augmentation) { + mergedScope.addAugmentationScope(augmentation); + + int originLength = typeParameters?.length ?? 0; + int augmentationLength = augmentation.typeParameters?.length ?? 0; + if (originLength != augmentationLength) { + // Coverage-ignore-block(suite): Not run. + augmentation.addProblem(messagePatchClassTypeParametersMismatch, + augmentation.fileOffset, noLength, context: [ + messagePatchClassOrigin.withLocation(fileUri, fileOffset, noLength) + ]); + } else if (typeParameters != null) { + int count = 0; + for (NominalParameterBuilder t in augmentation.typeParameters!) { + typeParameters![count++].applyAugmentation(t); + } } } @@ -1324,13 +1368,14 @@ class SourceClassBuilder extends ClassBuilderImpl return; } if (builder is SourceMemberBuilder) { - count += builder.buildBodyNodes(( - {required Member member, - Member? tearOff, - required BuiltMemberKind kind}) { + count += builder.buildBodyNodes( + // Coverage-ignore(suite): Not run. + ( + {required Member member, + Member? tearOff, + required BuiltMemberKind kind}) { _addMemberToClass(builder, member); if (tearOff != null) { - // Coverage-ignore-block(suite): Not run. _addMemberToClass(builder, tearOff); } }); @@ -1354,9 +1399,8 @@ class SourceClassBuilder extends ClassBuilderImpl !memberBuilder.isDuplicate && !memberBuilder.isConflictingSetter) { if (memberBuilder.isConflictingAugmentationMember) { - if (member is Field && - // Coverage-ignore(suite): Not run. - member.isStatic || + // Coverage-ignore-block(suite): Not run. + if (member is Field && member.isStatic || member is Procedure && member.isStatic) { member.name = new Name( '${member.name}' @@ -2293,7 +2337,8 @@ TypeBuilder? _applyMixins( NominalParameterCopy nominalVariableCopy = NominalParameterCopy.copyTypeParameters( - unboundNominalParameters, typeParameters, + unboundNominalParameters: unboundNominalParameters, + oldParameterBuilders: typeParameters, kind: TypeParameterKind.extensionSynthesized, instanceTypeParameterAccess: InstanceTypeParameterAccessState.Allowed)!; diff --git a/pkg/front_end/lib/src/source/source_compilation_unit.dart b/pkg/front_end/lib/src/source/source_compilation_unit.dart index c71ecd8da16..2f0e7eaf11a 100644 --- a/pkg/front_end/lib/src/source/source_compilation_unit.dart +++ b/pkg/front_end/lib/src/source/source_compilation_unit.dart @@ -263,7 +263,6 @@ class SourceCompilationUnitImpl implements SourceCompilationUnit { originImportUri.isScheme("dart") || fileUri.isScheme("org-dartlang-sdk"); @override - // Coverage-ignore(suite): Not run. bool get isPatch => forPatchLibrary; /// Returns the map of objects created in the [OutlineBuilder]. @@ -284,6 +283,13 @@ class SourceCompilationUnitImpl implements SourceCompilationUnit { return _libraryBuilder!; } + List? _augmentations; + + @override + void registerAugmentation(CompilationUnit augmentation) { + (_augmentations ??= []).add(augmentation); + } + @override SourceCompilationUnit? get parentCompilationUnit => _parentCompilationUnit; @@ -471,8 +477,8 @@ class SourceCompilationUnitImpl implements SourceCompilationUnit { "the compilation unit is finalized."); assert(_libraryBuilder == null, "Source library builder as already been created for $this."); - SourceLibraryBuilder libraryBuilder = _libraryBuilder = - new SourceLibraryBuilder( + SourceLibraryBuilder libraryBuilder = + _libraryBuilder = new SourceLibraryBuilder( compilationUnit: this, importUri: importUri, fileUri: fileUri, @@ -481,7 +487,9 @@ class SourceCompilationUnitImpl implements SourceCompilationUnit { packageLanguageVersion: packageLanguageVersion, loader: loader, nameOrigin: _nameOrigin, - origin: _augmentationRoot?.libraryBuilder, + origin: _augmentationRoot + // Coverage-ignore(suite): Not run. + ?.libraryBuilder, target: library, indexedLibrary: indexedLibrary, referenceIsPartOwner: _referenceIsPartOwner, @@ -590,14 +598,17 @@ class SourceCompilationUnitImpl implements SourceCompilationUnit { void includeParts( List includedParts, Set usedParts) { _includeParts( - libraryBuilder, _libraryNameSpaceBuilder, includedParts, usedParts); + libraryBuilder: libraryBuilder, + libraryNameSpaceBuilder: _libraryNameSpaceBuilder, + includedParts: includedParts, + usedParts: usedParts); } void _includeParts( - SourceLibraryBuilder libraryBuilder, - LibraryNameSpaceBuilder libraryNameSpaceBuilder, - List includedParts, - Set usedParts) { + {required SourceLibraryBuilder libraryBuilder, + required LibraryNameSpaceBuilder libraryNameSpaceBuilder, + required List includedParts, + required Set usedParts}) { Set seenParts = new Set(); for (Part part in _builderFactoryResult.parts) { // TODO(johnniwinther): Use [part.offset] in messages. @@ -615,8 +626,15 @@ class SourceCompilationUnitImpl implements SourceCompilationUnit { ]); } else { usedParts.add(part.compilationUnit.importUri); - _includePart(libraryBuilder, libraryNameSpaceBuilder, this, - includedParts, part.compilationUnit, usedParts, part.offset); + _includePartIfValid( + libraryBuilder: libraryBuilder, + libraryNameSpaceBuilder: libraryNameSpaceBuilder, + parentCompilationUnit: this, + includedParts: includedParts, + part: part.compilationUnit, + usedParts: usedParts, + partOffset: part.fileOffset, + partUri: fileUri); } } else { addProblem( @@ -626,16 +644,33 @@ class SourceCompilationUnitImpl implements SourceCompilationUnit { fileUri); } } + if (_augmentations != null) { + for (CompilationUnit augmentation in _augmentations!) { + switch (augmentation) { + case SourceCompilationUnit(): + _includePart(libraryBuilder, libraryNameSpaceBuilder, this, + includedParts, augmentation, usedParts, + partOffset: -1, + partUri: augmentation.fileUri, + allowPartInParts: true); + // Coverage-ignore(suite): Not run. + case DillCompilationUnit(): + // TODO(johnniwinther): Report an error here. + throw new UnsupportedError("Unexpected augmentation $augmentation"); + } + } + } } - void _includePart( - SourceLibraryBuilder libraryBuilder, - LibraryNameSpaceBuilder libraryNameSpaceBuilder, - SourceCompilationUnit parentCompilationUnit, - List includedParts, - CompilationUnit part, - Set usedParts, - int partOffset) { + void _includePartIfValid( + {required SourceLibraryBuilder libraryBuilder, + required LibraryNameSpaceBuilder libraryNameSpaceBuilder, + required SourceCompilationUnit parentCompilationUnit, + required List includedParts, + required CompilationUnit part, + required Set usedParts, + required Uri partUri, + required int partOffset}) { switch (part) { case SourceCompilationUnit(): if (part.partOfUri != null) { @@ -680,38 +715,12 @@ class SourceCompilationUnitImpl implements SourceCompilationUnit { } return; } - - // Language versions have to match. Except if (at least) one of them is - // invalid in which case we've already gotten an error about this. - if (parentCompilationUnit.languageVersion != part.languageVersion && - // Coverage-ignore(suite): Not run. - parentCompilationUnit.languageVersion.valid && - // Coverage-ignore(suite): Not run. - part.languageVersion.valid) { - // Coverage-ignore-block(suite): Not run. - // This is an error, but the part is not removed from the list of - // parts, so that metadata annotations can be associated with it. - List context = []; - if (parentCompilationUnit.languageVersion.isExplicit) { - context.add(messageLanguageVersionLibraryContext.withLocation( - parentCompilationUnit.languageVersion.fileUri!, - parentCompilationUnit.languageVersion.charOffset, - parentCompilationUnit.languageVersion.charCount)); - } - if (part.languageVersion.isExplicit) { - context.add(messageLanguageVersionPartContext.withLocation( - part.languageVersion.fileUri!, - part.languageVersion.charOffset, - part.languageVersion.charCount)); - } - parentCompilationUnit.addProblem(messageLanguageVersionMismatchInPart, - partOffset, noLength, parentCompilationUnit.fileUri, - context: context); - } - - includedParts.add(part); - part.becomePart(libraryBuilder, libraryNameSpaceBuilder, - parentCompilationUnit, includedParts, usedParts); + _includePart(libraryBuilder, libraryNameSpaceBuilder, + parentCompilationUnit, includedParts, part, usedParts, + partOffset: partOffset, + partUri: partUri, + allowPartInParts: + parentCompilationUnit.libraryFeatures.enhancedParts.isEnabled); case DillCompilationUnit(): // Trying to add a dill library builder as a part means that it exists // as a stand-alone library in the dill file. @@ -730,6 +739,67 @@ class SourceCompilationUnitImpl implements SourceCompilationUnit { } } + void _includePart( + SourceLibraryBuilder libraryBuilder, + LibraryNameSpaceBuilder libraryNameSpaceBuilder, + SourceCompilationUnit parentCompilationUnit, + List includedParts, + SourceCompilationUnit part, + Set usedParts, + {required int partOffset, + required Uri partUri, + required bool allowPartInParts}) { + // Language versions have to match. Except if (at least) one of them is + // invalid in which case we've already gotten an error about this. + if (parentCompilationUnit.languageVersion != part.languageVersion && + // Coverage-ignore(suite): Not run. + parentCompilationUnit.languageVersion.valid && + // Coverage-ignore(suite): Not run. + part.languageVersion.valid) { + // Coverage-ignore-block(suite): Not run. + // This is an error, but the part is not removed from the list of + // parts, so that metadata annotations can be associated with it. + List context = []; + if (parentCompilationUnit.languageVersion.isExplicit) { + context.add(messageLanguageVersionLibraryContext.withLocation( + parentCompilationUnit.languageVersion.fileUri!, + parentCompilationUnit.languageVersion.charOffset, + parentCompilationUnit.languageVersion.charCount)); + } + + if (part.isPatch) { + if (part.languageVersion.isExplicit) { + // Patches are implicitly include, so if we have an explicit language + // version, then point to this instead of the top of the file. + partOffset = part.languageVersion.charOffset; + partUri = part.languageVersion.fileUri!; + context.add(messageLanguageVersionPatchContext.withLocation( + part.languageVersion.fileUri!, + part.languageVersion.charOffset, + part.languageVersion.charCount)); + } + parentCompilationUnit.addProblem(messageLanguageVersionMismatchInPatch, + partOffset, noLength, partUri, + context: context); + } else { + if (part.languageVersion.isExplicit) { + context.add(messageLanguageVersionPartContext.withLocation( + part.languageVersion.fileUri!, + part.languageVersion.charOffset, + part.languageVersion.charCount)); + } + parentCompilationUnit.addProblem( + messageLanguageVersionMismatchInPart, partOffset, noLength, partUri, + context: context); + } + } + + includedParts.add(part); + part.becomePart(libraryBuilder, libraryNameSpaceBuilder, + parentCompilationUnit, includedParts, usedParts, + allowPartInParts: allowPartInParts); + } + void _becomePart(SourceLibraryBuilder libraryBuilder, LibraryNameSpaceBuilder libraryNameSpaceBuilder) { libraryNameSpaceBuilder.includeBuilders(_libraryNameSpaceBuilder); @@ -780,7 +850,8 @@ class SourceCompilationUnitImpl implements SourceCompilationUnit { LibraryNameSpaceBuilder libraryNameSpaceBuilder, SourceCompilationUnit parentCompilationUnit, List includedParts, - Set usedParts) { + Set usedParts, + {required bool allowPartInParts}) { assert( _libraryBuilder == null, "Compilation unit $this is already part of library $_libraryBuilder. " @@ -788,14 +859,14 @@ class SourceCompilationUnitImpl implements SourceCompilationUnit { _libraryBuilder = libraryBuilder; _partOfLibrary = libraryBuilder; _parentCompilationUnit = parentCompilationUnit; - if (!libraryFeatures.enhancedParts.isEnabled) { + if (!allowPartInParts) { if (_builderFactoryResult.parts.isNotEmpty) { List context = [ messagePartInPartLibraryContext.withLocation( libraryBuilder.fileUri, -1, 1), ]; for (Part part in _builderFactoryResult.parts) { - addProblem(messagePartInPart, part.offset, noLength, fileUri, + addProblem(messagePartInPart, part.fileOffset, noLength, fileUri, context: context); // Mark this part as used so we don't report it as orphaned. usedParts.add(part.compilationUnit.importUri); @@ -806,7 +877,10 @@ class SourceCompilationUnitImpl implements SourceCompilationUnit { } else { _becomePart(libraryBuilder, libraryNameSpaceBuilder); _includeParts( - libraryBuilder, libraryNameSpaceBuilder, includedParts, usedParts); + libraryBuilder: libraryBuilder, + libraryNameSpaceBuilder: libraryNameSpaceBuilder, + includedParts: includedParts, + usedParts: usedParts); } } diff --git a/pkg/front_end/lib/src/source/source_constructor_builder.dart b/pkg/front_end/lib/src/source/source_constructor_builder.dart index da6ba419581..61ed55b268f 100644 --- a/pkg/front_end/lib/src/source/source_constructor_builder.dart +++ b/pkg/front_end/lib/src/source/source_constructor_builder.dart @@ -57,9 +57,13 @@ abstract class SourceConstructorBuilder implements ConstructorBuilder { @override DeclarationBuilder get declarationBuilder; + void buildOutlineNodes(BuildNodesCallback f); + void buildOutlineExpressions(ClassHierarchy classHierarchy, List delayedDefaultValueCloners); + int buildBodyNodes(BuildNodesCallback f); + /// Infers the types of any untyped initializing formals. void inferFormalTypes(ClassHierarchyBase hierarchy); @@ -151,6 +155,7 @@ class SourceConstructorBuilderImpl extends SourceMemberBuilderImpl Builder get parent => declarationBuilder; @override + // Coverage-ignore(suite): Not run. List? get metadata => _introductory.metadata; @override @@ -209,8 +214,7 @@ class SourceConstructorBuilderImpl extends SourceMemberBuilderImpl // Coverage-ignore(suite): Not run. List? get augmentationsForTesting => _augmentations; - @override - void applyAugmentation(Builder augmentation) { + void _addAugmentation(Builder augmentation) { if (augmentation is SourceConstructorBuilderImpl) { if (checkAugmentation( augmentationLibraryBuilder: augmentation.libraryBuilder, @@ -228,6 +232,17 @@ class SourceConstructorBuilderImpl extends SourceMemberBuilderImpl } } + @override + void addAugmentation(Builder augmentation) { + _addAugmentation(augmentation); + } + + @override + // Coverage-ignore(suite): Not run. + void applyAugmentation(Builder augmentation) { + _addAugmentation(augmentation); + } + @override bool get isRedirecting => _introductory.isRedirecting; @@ -551,6 +566,13 @@ class SourceConstructorBuilderImpl extends SourceMemberBuilderImpl // it has issues, so do the constructors. inErrorRecovery: inErrorRecovery); context.reportGenericFunctionTypesForFormals(formals); + List? augmentations = _augmentations; + if (augmentations != null) { + for (SourceConstructorBuilderImpl augmentation in augmentations) { + count += augmentation.computeDefaultTypes(context, + inErrorRecovery: inErrorRecovery); + } + } return count; } @@ -622,14 +644,33 @@ class SourceConstructorBuilderImpl extends SourceMemberBuilderImpl libraryBuilder: libraryBuilder, declarationConstructor: invokeTarget, delayedDefaultValueCloners: _delayedDefaultValueCloners); + List? augmentations = _augmentations; + if (augmentations != null) { + for (SourceConstructorBuilder augmentation in augmentations) { + augmentation.buildOutlineNodes(( + {required Member member, + Member? tearOff, + required BuiltMemberKind kind}) { + // Don't add augmentations. + }); + } + } } @override int buildBodyNodes(BuildNodesCallback f) { _introductory.buildBody(); - if (!isAugmenting) return 0; - _introductory.finishAugmentation(origin); - return 1; + int count = 0; + List? augmentations = _augmentations; + if (augmentations != null) { + for (SourceConstructorBuilder augmentation in augmentations) { + count += augmentation.buildBodyNodes(f); + } + } + if (isAugmenting) { + _introductory.finishAugmentation(origin); + } + return count; } @override @@ -707,9 +748,18 @@ class SourceConstructorBuilderImpl extends SourceMemberBuilderImpl beginInitializers = null; _hasBuiltOutlines = true; + + List? augmentations = _augmentations; + if (augmentations != null) { + for (SourceConstructorBuilder augmentation in augmentations) { + augmentation.buildOutlineExpressions( + classHierarchy, delayedDefaultValueCloners); + } + } } @override + // Coverage-ignore(suite): Not run. String get fullNameForErrors { return "${declarationBuilder.name}" "${name.isEmpty ? '' : '.$name'}"; diff --git a/pkg/front_end/lib/src/source/source_extension_builder.dart b/pkg/front_end/lib/src/source/source_extension_builder.dart index a6ff5250a9c..a16a8adb3a0 100644 --- a/pkg/front_end/lib/src/source/source_extension_builder.dart +++ b/pkg/front_end/lib/src/source/source_extension_builder.dart @@ -5,7 +5,6 @@ import 'package:kernel/ast.dart'; import 'package:kernel/class_hierarchy.dart'; -import '../base/common.dart'; import '../base/modifiers.dart'; import '../base/name_space.dart'; import '../base/problems.dart'; @@ -19,6 +18,8 @@ import '../codes/cfe_codes.dart' show messagePatchDeclarationMismatch, messagePatchDeclarationOrigin, + messagePatchExtensionOrigin, + messagePatchExtensionTypeParametersMismatch, noLength; import '../fragment/fragment.dart'; import '../kernel/body_builder_context.dart'; @@ -44,7 +45,7 @@ class SourceExtensionBuilder extends ExtensionBuilderImpl late final Extension _extension; SourceExtensionBuilder? _origin; - SourceExtensionBuilder? augmentationForTesting; + SourceExtensionBuilder? _augmentation; MergedClassMemberScope? _mergedScope; @@ -104,6 +105,7 @@ class SourceExtensionBuilder extends ExtensionBuilderImpl extensionName.attachExtension(_extension); } + // Coverage-ignore(suite): Not run. // TODO(johnniwinther): Avoid exposing this. Annotations for macros and // patches should be computing from within the builder. Iterable? get metadata => _introductory.metadata; @@ -128,8 +130,15 @@ class SourceExtensionBuilder extends ExtensionBuilderImpl @override bool get isAugment => _modifiers.isAugment; + // Coverage-ignore(suite): Not run. + SourceExtensionBuilder? get augmentationForTesting => _augmentation; + @override void buildScopes(LibraryBuilder coreLibrary) { + SourceExtensionBuilder? augmentation = _augmentation; + if (augmentation != null) { + _nameSpaceBuilder.includeBuilders(augmentation._nameSpaceBuilder); + } _nameSpace = _nameSpaceBuilder.buildNameSpace( loader: libraryBuilder.loader, problemReporting: libraryBuilder, @@ -142,6 +151,10 @@ class SourceExtensionBuilder extends ExtensionBuilderImpl containerType: ContainerType.Extension, containerName: extensionName, includeConstructors: false); + if (augmentation != null) { + augmentation.buildScopes(coreLibrary); + _applyAugmentation(augmentation); + } } @override @@ -203,6 +216,12 @@ class SourceExtensionBuilder extends ExtensionBuilderImpl _introductory.enclosingScope); super.buildOutlineExpressions(classHierarchy, delayedDefaultValueCloners); + + SourceExtensionBuilder? augmentation = _augmentation; + if (augmentation != null) { + augmentation.buildOutlineExpressions( + classHierarchy, delayedDefaultValueCloners); + } } @override @@ -269,32 +288,15 @@ class SourceExtensionBuilder extends ExtensionBuilderImpl } @override - void applyAugmentation(Builder augmentation) { + void addAugmentation(Builder augmentation) { + _addAugmentation(augmentation); + } + + SourceExtensionBuilder? _addAugmentation(Builder augmentation) { if (augmentation is SourceExtensionBuilder) { augmentation._origin = this; - if (retainDataForTesting) { - // Coverage-ignore-block(suite): Not run. - augmentationForTesting = augmentation; - } - // TODO(johnniwinther): Check that type parameters and on-type match - // with origin declaration. - - nameSpace.forEachLocalMember((String name, Builder member) { - Builder? memberAugmentation = - augmentation.nameSpace.lookupLocalMember(name, setter: false); - if (memberAugmentation != null) { - member.applyAugmentation(memberAugmentation); - } - }); - nameSpace.forEachLocalSetter( - // Coverage-ignore(suite): Not run. - (String name, Builder member) { - Builder? memberAugmentation = - augmentation.nameSpace.lookupLocalMember(name, setter: true); - if (memberAugmentation != null) { - member.applyAugmentation(memberAugmentation); - } - }); + _augmentation = augmentation; + return augmentation; } else { // Coverage-ignore-block(suite): Not run. libraryBuilder.addProblem(messagePatchDeclarationMismatch, @@ -302,6 +304,51 @@ class SourceExtensionBuilder extends ExtensionBuilderImpl messagePatchDeclarationOrigin.withLocation( fileUri, fileOffset, noLength) ]); + return null; + } + } + + void _applyAugmentation(SourceExtensionBuilder augmentation) { + // TODO(johnniwinther): Check that on-type match with origin declaration. + + int originLength = typeParameters?.length ?? 0; + int augmentationLength = augmentation.typeParameters?.length ?? 0; + if (originLength != augmentationLength) { + // Coverage-ignore-block(suite): Not run. + augmentation.addProblem(messagePatchExtensionTypeParametersMismatch, + augmentation.fileOffset, noLength, context: [ + messagePatchExtensionOrigin.withLocation(fileUri, fileOffset, noLength) + ]); + } else if (typeParameters != null) { + int count = 0; + for (NominalParameterBuilder t in augmentation.typeParameters!) { + typeParameters![count++].applyAugmentation(t); + } + } + nameSpace.forEachLocalMember((String name, Builder member) { + Builder? memberAugmentation = + augmentation.nameSpace.lookupLocalMember(name, setter: false); + if (memberAugmentation != null) { + // Coverage-ignore-block(suite): Not run. + member.applyAugmentation(memberAugmentation); + } + }); + nameSpace.forEachLocalSetter((String name, Builder member) { + Builder? memberAugmentation = + augmentation.nameSpace.lookupLocalMember(name, setter: true); + if (memberAugmentation != null) { + // Coverage-ignore-block(suite): Not run. + member.applyAugmentation(memberAugmentation); + } + }); + } + + @override + // Coverage-ignore(suite): Not run. + void applyAugmentation(Builder augmentation) { + SourceExtensionBuilder? extensionBuilder = _addAugmentation(augmentation); + if (extensionBuilder != null) { + _applyAugmentation(extensionBuilder); } } } diff --git a/pkg/front_end/lib/src/source/source_extension_type_declaration_builder.dart b/pkg/front_end/lib/src/source/source_extension_type_declaration_builder.dart index c4b01977871..17e2392ca34 100644 --- a/pkg/front_end/lib/src/source/source_extension_type_declaration_builder.dart +++ b/pkg/front_end/lib/src/source/source_extension_type_declaration_builder.dart @@ -61,7 +61,7 @@ class SourceExtensionTypeDeclarationBuilder final Modifiers _modifiers; @override - final List? constructorReferences; + final List constructorReferences; late final ExtensionTypeDeclaration _extensionTypeDeclaration; @@ -90,6 +90,8 @@ class SourceExtensionTypeDeclarationBuilder Nullability? _nullability; + SourceExtensionTypeDeclarationBuilder? _augmentation; + SourceExtensionTypeDeclarationBuilder( {required this.name, required SourceLibraryBuilder enclosingLibraryBuilder, @@ -124,6 +126,16 @@ class SourceExtensionTypeDeclarationBuilder ..fileOffset = nameOffset; } + // TODO(johnniwinther): Remove this when augmentations are handled through + // fragments. + @override + List? get augmentations => + _augmentation != null + ? + // Coverage-ignore(suite): Not run. + [_augmentation!] + : const []; + // TODO(johnniwinther): Remove this when augmentations are handled through // fragments. @override @@ -162,6 +174,11 @@ class SourceExtensionTypeDeclarationBuilder indexedContainer: indexedContainer, containerType: ContainerType.ExtensionType, containerName: new ClassName(name)); + SourceExtensionTypeDeclarationBuilder? augmentation = _augmentation; + if (augmentation != null) { + // Coverage-ignore-block(suite): Not run. + _applyAugmentation(augmentation); + } } @override @@ -835,32 +852,55 @@ class SourceExtensionTypeDeclarationBuilder @override // Coverage-ignore(suite): Not run. - void applyAugmentation(Builder augmentation) { + void addAugmentation(Builder augmentation) { + _addAugmentation(augmentation); + } + + // Coverage-ignore(suite): Not run. + SourceExtensionTypeDeclarationBuilder? _addAugmentation( + Builder augmentation) { if (augmentation is SourceExtensionTypeDeclarationBuilder) { augmentation._origin = this; - nameSpace.forEachLocalMember((String name, Builder member) { - Builder? memberAugmentation = - augmentation.nameSpace.lookupLocalMember(name, setter: false); - if (memberAugmentation != null) { - member.applyAugmentation(memberAugmentation); - } - }); - nameSpace.forEachLocalSetter((String name, Builder member) { - Builder? memberAugmentation = - augmentation.nameSpace.lookupLocalMember(name, setter: true); - if (memberAugmentation != null) { - member.applyAugmentation(memberAugmentation); - } - }); - - // TODO(johnniwinther): Check that type parameters and on-type match - // with origin declaration. + _augmentation = augmentation; + return augmentation; } else { libraryBuilder.addProblem(messagePatchDeclarationMismatch, augmentation.fileOffset, noLength, augmentation.fileUri, context: [ messagePatchDeclarationOrigin.withLocation( fileUri, fileOffset, noLength) ]); + return null; + } + } + + // Coverage-ignore(suite): Not run. + void _applyAugmentation(SourceExtensionTypeDeclarationBuilder augmentation) { + nameSpace.forEachLocalMember((String name, Builder member) { + Builder? memberAugmentation = + augmentation.nameSpace.lookupLocalMember(name, setter: false); + if (memberAugmentation != null) { + member.applyAugmentation(memberAugmentation); + } + }); + nameSpace.forEachLocalSetter((String name, Builder member) { + Builder? memberAugmentation = + augmentation.nameSpace.lookupLocalMember(name, setter: true); + if (memberAugmentation != null) { + member.applyAugmentation(memberAugmentation); + } + }); + + // TODO(johnniwinther): Check that type parameters and on-type match + // with origin declaration. + } + + @override + // Coverage-ignore(suite): Not run. + void applyAugmentation(Builder augmentation) { + SourceExtensionTypeDeclarationBuilder? extensionTypeDeclarationBuilder = + _addAugmentation(augmentation); + if (extensionTypeDeclarationBuilder != null) { + _applyAugmentation(extensionTypeDeclarationBuilder); } } diff --git a/pkg/front_end/lib/src/source/source_factory_builder.dart b/pkg/front_end/lib/src/source/source_factory_builder.dart index 8a1e03f4661..1a644c9bf17 100644 --- a/pkg/front_end/lib/src/source/source_factory_builder.dart +++ b/pkg/front_end/lib/src/source/source_factory_builder.dart @@ -101,6 +101,7 @@ class SourceFactoryBuilder extends SourceMemberBuilderImpl tearOffReference: tearOffReference); @override + // Coverage-ignore(suite): Not run. List? get metadata => _introductory.metadata; @override @@ -274,7 +275,11 @@ class SourceFactoryBuilder extends SourceMemberBuilderImpl throw new UnsupportedError('${runtimeType}.localSetters'); @override - void applyAugmentation(Builder augmentation) { + void addAugmentation(Builder augmentation) { + _addAugmentation(augmentation); + } + + void _addAugmentation(Builder augmentation) { if (augmentation is SourceFactoryBuilder) { if (checkAugmentation( augmentationLibraryBuilder: augmentation.libraryBuilder, @@ -292,18 +297,40 @@ class SourceFactoryBuilder extends SourceMemberBuilderImpl } } + @override + // Coverage-ignore(suite): Not run. + void applyAugmentation(Builder augmentation) { + _addAugmentation(augmentation); + } + @override int buildBodyNodes(BuildNodesCallback f) { - if (!isAugmenting) return 0; - _finishAugmentation(); - return 1; + int count = 0; + List? augmentations = _augmentations; + if (augmentations != null) { + for (SourceFactoryBuilder augmentation in augmentations) { + count += augmentation.buildBodyNodes(f); + } + } + if (isAugmenting) { + _finishAugmentation(); + } + return count; } @override int computeDefaultTypes(ComputeDefaultTypeContext context, {required bool inErrorRecovery}) { - return _encoding.computeDefaultTypes(context, + int count = _encoding.computeDefaultTypes(context, inErrorRecovery: inErrorRecovery); + List? augmentations = _augmentations; + if (augmentations != null) { + for (SourceFactoryBuilder augmentation in augmentations) { + count += augmentation.computeDefaultTypes(context, + inErrorRecovery: inErrorRecovery); + } + } + return count; } @override @@ -377,6 +404,17 @@ class SourceFactoryBuilder extends SourceMemberBuilderImpl @override void buildOutlineNodes(BuildNodesCallback f) { _encoding.buildOutlineNodes(f); + List? augmentations = _augmentations; + if (augmentations != null) { + for (SourceFactoryBuilder augmentation in augmentations) { + augmentation.buildOutlineNodes(( + {required Member member, + Member? tearOff, + required BuiltMemberKind kind}) { + // Don't add augmentations. + }); + } + } } bool _hasBuiltOutlineExpressions = false; @@ -398,6 +436,14 @@ class SourceFactoryBuilder extends SourceMemberBuilderImpl if (isConst && isAugmenting) { _finishAugmentation(); } + + List? augmentations = _augmentations; + if (augmentations != null) { + for (SourceFactoryBuilder augmentation in augmentations) { + augmentation.buildOutlineExpressions( + classHierarchy, delayedDefaultValueCloners); + } + } } void _finishAugmentation() { @@ -421,6 +467,13 @@ class SourceFactoryBuilder extends SourceMemberBuilderImpl void resolveRedirectingFactory() { _encoding.resolveRedirectingFactory(); + + List? augmentations = _augmentations; + if (augmentations != null) { + for (SourceFactoryBuilder augmentation in augmentations) { + augmentation.resolveRedirectingFactory(); + } + } } void _setRedirectingFactoryBody(Member target, List typeArguments) { diff --git a/pkg/front_end/lib/src/source/source_function_builder.dart b/pkg/front_end/lib/src/source/source_function_builder.dart index f8b76fa80a8..48fbc4bee4e 100644 --- a/pkg/front_end/lib/src/source/source_function_builder.dart +++ b/pkg/front_end/lib/src/source/source_function_builder.dart @@ -163,7 +163,9 @@ bool checkAugmentation( {required SourceLibraryBuilder augmentationLibraryBuilder, required Builder origin, required Builder augmentation}) { - if (!origin.isExternal && !augmentationLibraryBuilder.isAugmentationLibrary) { + if (!origin.isExternal && + // Coverage-ignore(suite): Not run. + !augmentationLibraryBuilder.isAugmentationLibrary) { // Coverage-ignore-block(suite): Not run. augmentationLibraryBuilder.addProblem(messagePatchNonExternal, augmentation.fileOffset, noLength, augmentation.fileUri!, diff --git a/pkg/front_end/lib/src/source/source_library_builder.dart b/pkg/front_end/lib/src/source/source_library_builder.dart index 0011b37ce6c..39d5f8bcd08 100644 --- a/pkg/front_end/lib/src/source/source_library_builder.dart +++ b/pkg/front_end/lib/src/source/source_library_builder.dart @@ -241,7 +241,9 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { required NameSpace importNameSpace, required LibraryNameSpaceBuilder libraryNameSpaceBuilder}) { Library library = target ?? - (origin?.library ?? + (origin + // Coverage-ignore(suite): Not run. + ?.library ?? new Library(importUri, fileUri: fileUri, reference: referenceIsPartOwner == true @@ -249,7 +251,10 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { : indexedLibrary?.library.reference) ..setLanguageVersion(packageLanguageVersion.version)); LibraryName libraryName = new LibraryName(library.reference); - NameSpace exportNameSpace = origin?.exportNameSpace ?? new NameSpaceImpl(); + NameSpace exportNameSpace = origin + // Coverage-ignore(suite): Not run. + ?.exportNameSpace ?? + new NameSpaceImpl(); return new SourceLibraryBuilder._( compilationUnit: compilationUnit, loader: loader, @@ -355,6 +360,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { bool get mayImplementRestrictedTypes => compilationUnit.mayImplementRestrictedTypes; + // Coverage-ignore(suite): Not run. /// `true` if this is an augmentation library. bool get isAugmentationLibrary => compilationUnit.forAugmentationLibrary; @@ -364,6 +370,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { @override bool get isUnsupported => compilationUnit.isUnsupported; + // Coverage-ignore(suite): Not run. MergedLibraryScope get mergedScope { return _mergedScope ??= isAugmenting ? origin.mergedScope : new MergedLibraryScope(this); @@ -397,6 +404,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { Iterable get parts => _parts; @override + // Coverage-ignore(suite): Not run. bool get isPart => compilationUnit.isPart; @override @@ -417,6 +425,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { Iterable? get augmentationLibraries => _augmentationLibraries; + // Coverage-ignore(suite): Not run. void addAugmentationLibrary(SourceLibraryBuilder augmentationLibrary) { assert(augmentationLibrary.isAugmenting, "Library ${augmentationLibrary} must be a augmentation library."); @@ -461,6 +470,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { Iterable? augmentationLibraries = this.augmentationLibraries; if (augmentationLibraries != null) { + // Coverage-ignore-block(suite): Not run. for (SourceLibraryBuilder augmentationLibrary in augmentationLibraries) { augmentationLibrary.computeSupertypes(); } @@ -481,6 +491,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { Iterable? augmentationLibraries = this.augmentationLibraries; if (augmentationLibraries != null) { + // Coverage-ignore-block(suite): Not run. for (SourceLibraryBuilder augmentationLibrary in augmentationLibraries) { augmentationLibrary.buildOutlineNodes(coreLibrary); } @@ -541,6 +552,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { Iterable? augmentationLibraries = this.augmentationLibraries; if (augmentationLibraries != null) { + // Coverage-ignore-block(suite): Not run. for (SourceLibraryBuilder augmentationLibrary in augmentationLibraries) { // Augmentation libraries don't have their own export scope. augmentationLibrary.state = @@ -558,6 +570,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { Iterable? augmentationLibraries = this.augmentationLibraries; if (augmentationLibraries != null) { + // Coverage-ignore-block(suite): Not run. for (SourceLibraryBuilder augmentationLibrary in augmentationLibraries) { // Augmentation libraries don't have their own export scope. // TODO(johnniwinther): Do we need this? @@ -638,6 +651,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { Iterable? augmentationLibraries = this.augmentationLibraries; if (augmentationLibraries != null) { + // Coverage-ignore-block(suite): Not run. for (SourceLibraryBuilder augmentationLibrary in augmentationLibraries) { augmentationLibrary.buildNameSpace(); } @@ -669,6 +683,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { Iterable? augmentationLibraries = this.augmentationLibraries; if (augmentationLibraries != null) { + // Coverage-ignore-block(suite): Not run. for (SourceLibraryBuilder augmentationLibrary in augmentationLibraries) { augmentationLibrary.buildScopes(coreLibrary); } @@ -683,6 +698,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { } if (augmentationLibraries != null) { + // Coverage-ignore-block(suite): Not run. for (SourceLibraryBuilder augmentationLibrary in augmentationLibraries) { augmentationLibrary.applyAugmentations(); } @@ -700,6 +716,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { Iterable? augmentationLibraries = this.augmentationLibraries; if (augmentationLibraries != null) { + // Coverage-ignore-block(suite): Not run. for (SourceLibraryBuilder augmentationLibrary in augmentationLibraries) { typeCount += augmentationLibrary.resolveTypes(); } @@ -719,6 +736,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { Iterable? augmentationLibraries = this.augmentationLibraries; if (augmentationLibraries != null) { + // Coverage-ignore-block(suite): Not run. for (SourceLibraryBuilder augmentationLibrary in augmentationLibraries) { augmentationLibrary.installDefaultSupertypes( objectClassBuilder, objectClass); @@ -738,6 +756,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { Iterable? augmentationLibraries = this.augmentationLibraries; if (augmentationLibraries != null) { + // Coverage-ignore-block(suite): Not run. for (SourceLibraryBuilder augmentationLibrary in augmentationLibraries) { augmentationLibrary.collectSourceClassesAndExtensionTypes( sourceClasses, sourceExtensionTypes); @@ -764,6 +783,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { Iterable? augmentationLibraries = this.augmentationLibraries; if (augmentationLibraries != null) { + // Coverage-ignore-block(suite): Not run. for (SourceLibraryBuilder augmentationLibrary in augmentationLibraries) { count += augmentationLibrary.resolveConstructors(); } @@ -982,6 +1002,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { Iterable? augmentationLibraries = this.augmentationLibraries; if (augmentationLibraries != null) { + // Coverage-ignore-block(suite): Not run. for (SourceLibraryBuilder augmentationLibrary in augmentationLibraries) { augmentationLibrary.takeMixinApplications(mixinApplications); } @@ -997,6 +1018,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { Iterable? augmentationLibraries = this.augmentationLibraries; if (augmentationLibraries != null) { + // Coverage-ignore-block(suite): Not run. for (SourceLibraryBuilder augmentationLibrary in augmentationLibraries) { augmentationLibrary.buildOutlineExpressions( classHierarchy, delayedDefaultValueCloners); @@ -1136,6 +1158,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { !declaration.isDuplicate && !declaration.isConflictingSetter) { if (declaration.isConflictingAugmentationMember) { + // Coverage-ignore-block(suite): Not run. member.name = new Name( '${member.name.text}' '#${declaration.libraryBuilder.augmentationIndex}', @@ -1163,6 +1186,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { Iterable? augmentationLibraries = this.augmentationLibraries; if (augmentationLibraries != null) { + // Coverage-ignore-block(suite): Not run. for (SourceLibraryBuilder augmentationLibrary in augmentationLibraries) { total += augmentationLibrary.finishDeferredLoadTearOffs(); } @@ -1181,6 +1205,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { Iterable? augmentationLibraries = this.augmentationLibraries; if (augmentationLibraries != null) { + // Coverage-ignore-block(suite): Not run. for (SourceLibraryBuilder augmentationLibrary in augmentationLibraries) { count += augmentationLibrary.finishForwarders(); } @@ -1240,6 +1265,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { Iterable? augmentationLibraries = this.augmentationLibraries; if (augmentationLibraries != null) { + // Coverage-ignore-block(suite): Not run. for (SourceLibraryBuilder augmentationLibrary in augmentationLibraries) { count += augmentationLibrary.finishNativeMethods(); } @@ -1268,6 +1294,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { Iterable? augmentationLibraries = this.augmentationLibraries; if (augmentationLibraries != null) { + // Coverage-ignore-block(suite): Not run. for (SourceLibraryBuilder augmentationLibrary in augmentationLibraries) { augmentationLibrary.collectUnboundTypeParameters( nominalParameters, structuralParameters); @@ -1302,6 +1329,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { Iterable? augmentationLibraries = this.augmentationLibraries; if (augmentationLibraries != null) { + // Coverage-ignore-block(suite): Not run. for (SourceLibraryBuilder augmentationLibrary in augmentationLibraries) { count += augmentationLibrary.computeVariances(); } @@ -1326,6 +1354,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { Iterable? augmentationLibraries = this.augmentationLibraries; if (augmentationLibraries != null) { + // Coverage-ignore-block(suite): Not run. for (SourceLibraryBuilder augmentationLibrary in augmentationLibraries) { count += augmentationLibrary.computeDefaultTypes( dynamicType, nullType, bottomType, objectClass); @@ -1339,12 +1368,12 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { return count; } + // Coverage-ignore(suite): Not run. /// If this is an augmentation library, apply its augmentations to [origin]. void applyAugmentations() { if (!isAugmenting) return; if (_languageVersion != origin._languageVersion) { - // Coverage-ignore-block(suite): Not run. List context = []; if (origin._languageVersion.isExplicit) { context.add(messageLanguageVersionLibraryContext.withLocation( @@ -1379,6 +1408,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { Iterable? augmentationLibraries = this.augmentationLibraries; if (augmentationLibraries != null) { + // Coverage-ignore-block(suite): Not run. for (SourceLibraryBuilder augmentationLibrary in augmentationLibraries) { count += augmentationLibrary.buildBodyNodes(); } @@ -1388,13 +1418,14 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { while (iterator.moveNext()) { Builder builder = iterator.current; if (builder is SourceMemberBuilder) { - count += builder.buildBodyNodes(( - {required Member member, - Member? tearOff, - required BuiltMemberKind kind}) { + count += builder.buildBodyNodes( + // Coverage-ignore(suite): Not run. + ( + {required Member member, + Member? tearOff, + required BuiltMemberKind kind}) { _addMemberToLibrary(builder, member); if (tearOff != null) { - // Coverage-ignore-block(suite): Not run. _addMemberToLibrary(builder, tearOff); } }); @@ -1841,6 +1872,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { Iterable? augmentationLibraries = this.augmentationLibraries; if (augmentationLibraries != null) { + // Coverage-ignore-block(suite): Not run. for (SourceLibraryBuilder augmentationLibrary in augmentationLibraries) { augmentationLibrary.checkTypesInOutline(typeEnvironment); } @@ -2072,12 +2104,12 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { Iterable? augmentationLibraries = this.augmentationLibraries; if (augmentationLibraries != null) { + // Coverage-ignore-block(suite): Not run. for (SourceLibraryBuilder augmentationLibrary in augmentationLibraries) { List? augmentationLibraryDelayedDefaultValueCloners = augmentationLibrary.installTypedefTearOffs(); if (augmentationLibraryDelayedDefaultValueCloners != null) { - // Coverage-ignore-block(suite): Not run. (delayedDefaultValueCloners ??= []) .addAll(augmentationLibraryDelayedDefaultValueCloners); } @@ -2418,8 +2450,12 @@ class SourceLibraryBuilderMemberNameIterator } class Part { - final int offset; + final Uri fileUri; + final int fileOffset; final CompilationUnit compilationUnit; - Part(this.offset, this.compilationUnit); + Part( + {required this.fileUri, + required this.fileOffset, + required this.compilationUnit}); } diff --git a/pkg/front_end/lib/src/source/source_loader.dart b/pkg/front_end/lib/src/source/source_loader.dart index a7f0ff28a7e..4bfa130b0f7 100644 --- a/pkg/front_end/lib/src/source/source_loader.dart +++ b/pkg/front_end/lib/src/source/source_loader.dart @@ -342,7 +342,6 @@ class SourceLoader extends Loader { _loadedLibraryBuilders[uri] = libraryBuilder; } - // Coverage-ignore(suite): Not run. LibraryBuilder? deregisterLoadedLibraryBuilder(Uri importUri) { LibraryBuilder? libraryBuilder = _loadedLibraryBuilders.remove(importUri); if (libraryBuilder != null) { @@ -1245,6 +1244,7 @@ severity: $severity Iterable? augmentationLibraries = library.augmentationLibraries; if (augmentationLibraries != null) { + // Coverage-ignore-block(suite): Not run. for (SourceLibraryBuilder augmentationLibrary in augmentationLibraries) { await buildBody(augmentationLibrary); } @@ -1425,24 +1425,6 @@ severity: $severity library.includeParts(usedParts); } - List augmentationLibraries = []; - - // Create augmentation libraries now that normal libraries have been - // created. - for (SourceCompilationUnit compilationUnit - in augmentationCompilationUnits) { - SourceLibraryBuilder sourceLibraryBuilder = - compilationUnit.createLibrary(); - // TODO(johnniwinther): Avoid creating a [SourceLibraryBuilder] - // for augmentation libraries. - augmentationLibraries.add(sourceLibraryBuilder); - } - - // Include parts in augment libraries. - for (SourceLibraryBuilder library in augmentationLibraries) { - library.includeParts(usedParts); - } - for (MapEntry entry in parts.entries) { Uri uri = entry.key; SourceCompilationUnit part = entry.value; @@ -1461,26 +1443,7 @@ severity: $severity } ticker.logMs("Resolved parts"); - for (SourceLibraryBuilder augmentationLibrary in augmentationLibraries) { - _compilationUnits.remove(augmentationLibrary.fileUri); - augmentationLibrary.origin.addAugmentationLibrary(augmentationLibrary); - } _sourceLibraryBuilders = sourceLibraries; - assert( - _compilationUnits.values.every((compilationUnit) => - !(compilationUnit is SourceCompilationUnit && - compilationUnit.isAugmenting)), - "Augmentation library found in libraryBuilders: " + - _compilationUnits.values - .where((compilationUnit) => - !(compilationUnit is SourceCompilationUnit && - compilationUnit.isAugmenting)) - .join(', ') + - "."); - assert( - sourceLibraries.every((library) => !library.isAugmenting), - "Augmentation library found in sourceLibraryBuilders: " - "${sourceLibraries.where((library) => library.isAugmenting)}."); assert( _compilationUnits.values.every((compilationUnit) => compilationUnit.loader != this || @@ -2687,6 +2650,7 @@ severity: $severity Iterable? augmentationLibraries = libraryBuilder.augmentationLibraries; if (augmentationLibraries != null) { + // Coverage-ignore-block(suite): Not run. for (SourceLibraryBuilder augmentationLibrary in augmentationLibraries) { _checkMainMethods(augmentationLibrary, listOfString); } diff --git a/pkg/front_end/lib/src/source/source_member_builder.dart b/pkg/front_end/lib/src/source/source_member_builder.dart index 43a412c3a3c..b795becbdff 100644 --- a/pkg/front_end/lib/src/source/source_member_builder.dart +++ b/pkg/front_end/lib/src/source/source_member_builder.dart @@ -139,6 +139,7 @@ abstract class SourceMemberBuilderImpl extends MemberBuilderImpl } @override + // Coverage-ignore(suite): Not run. void set isConflictingAugmentationMember(bool value) { assert(_isConflictingAugmentationMember == null, '$this.isConflictingAugmentationMember has already been fixed.'); @@ -201,6 +202,7 @@ class MemberDataForTesting { final InferenceDataForTesting inferenceData = new InferenceDataForTesting(); } +// Coverage-ignore(suite): Not run. class AugmentSuperTarget { final SourceMemberBuilder declaration; final Member? readTarget; diff --git a/pkg/front_end/lib/src/source/source_method_builder.dart b/pkg/front_end/lib/src/source/source_method_builder.dart index 5b113909d20..fe31ba916f9 100644 --- a/pkg/front_end/lib/src/source/source_method_builder.dart +++ b/pkg/front_end/lib/src/source/source_method_builder.dart @@ -102,6 +102,7 @@ class SourceMethodBuilder extends SourceMemberBuilderImpl Builder get parent => declarationBuilder ?? libraryBuilder; @override + // Coverage-ignore(suite): Not run. bool get isAugmentation => _modifiers.isAugment; @override @@ -137,19 +138,25 @@ class SourceMethodBuilder extends SourceMemberBuilderImpl invokeTarget as Annotatable, ]; + // Coverage-ignore(suite): Not run. // TODO(johnniwinther): Remove this. This is only needed for detecting patches // and macro annotations and we should use the fragment directly once // augmentations are fragments. List? get metadata => _introductory.metadata; @override - void applyAugmentation(Builder augmentation) { + void addAugmentation(Builder augmentation) { + _addAugmentation(augmentation); + } + + void _addAugmentation(Builder augmentation) { if (augmentation is SourceMethodBuilder) { if (checkAugmentation( augmentationLibraryBuilder: augmentation.libraryBuilder, origin: this, augmentation: augmentation)) { augmentation._origin = this; + SourceMethodBuilder augmentedBuilder = _augmentations == null ? this : _augmentations!.last; augmentation._augmentedBuilder = augmentedBuilder; @@ -166,6 +173,12 @@ class SourceMethodBuilder extends SourceMemberBuilderImpl } } + @override + // Coverage-ignore(suite): Not run. + void applyAugmentation(Builder augmentation) { + _addAugmentation(augmentation); + } + @override SourceMethodBuilder get origin => _origin ?? this; @@ -182,13 +195,13 @@ class SourceMethodBuilder extends SourceMemberBuilderImpl Map _augmentedMethods = {}; + // Coverage-ignore(suite): Not run. AugmentSuperTarget? _createAugmentSuperTarget( SourceMethodBuilder? targetBuilder) { if (targetBuilder == null) return null; Procedure declaredMethod = targetBuilder._introductory.invokeTarget; if (declaredMethod.isAbstract || declaredMethod.isExternal) { - // Coverage-ignore-block(suite): Not run. return targetBuilder._augmentedBuilder != null ? _getAugmentSuperTarget(targetBuilder._augmentedBuilder!) : null; @@ -212,12 +225,14 @@ class SourceMethodBuilder extends SourceMemberBuilderImpl writeTarget: null); } + // Coverage-ignore(suite): Not run. AugmentSuperTarget? _getAugmentSuperTarget(SourceMethodBuilder augmentation) { return _augmentedMethods[augmentation] ??= _createAugmentSuperTarget(augmentation._augmentedBuilder); } @override + // Coverage-ignore(suite): Not run. AugmentSuperTarget? get augmentSuperTarget => origin._getAugmentSuperTarget(this); @@ -228,6 +243,7 @@ class SourceMethodBuilder extends SourceMemberBuilderImpl void addAugmentedMethod(SourceMethodBuilder builder) { Procedure? augmentedMethod = builder._augmentedMethod; if (augmentedMethod != null) { + // Coverage-ignore-block(suite): Not run. augmentedMethod ..fileOffset = builder._introductory.invokeTarget.fileOffset ..fileEndOffset = builder._introductory.invokeTarget.fileEndOffset @@ -257,6 +273,17 @@ class SourceMethodBuilder extends SourceMemberBuilderImpl reference: _reference, tearOffReference: _tearOffReference, classTypeParameters: classBuilder?.cls.typeParameters); + List? augmentations = _augmentations; + if (augmentations != null) { + for (SourceMethodBuilder augmentation in augmentations) { + augmentation.buildOutlineNodes(( + {required Member member, + Member? tearOff, + required BuiltMemberKind kind}) { + // Don't add augmentations. + }); + } + } } bool hasBuiltOutlineExpressions = false; @@ -269,6 +296,13 @@ class SourceMethodBuilder extends SourceMemberBuilderImpl declarationBuilder, invokeTarget as Annotatable, isClassInstanceMember: isClassInstanceMember, createFileUriExpression: isAugmented); + List? augmentations = _augmentations; + if (augmentations != null) { + for (SourceMethodBuilder augmentation in augmentations) { + augmentation.buildOutlineExpressions( + classHierarchy, delayedDefaultValueCloners); + } + } hasBuiltOutlineExpressions = true; } } @@ -322,8 +356,11 @@ class SourceMethodBuilder extends SourceMemberBuilderImpl Name get memberName => _memberName.name; @override - Member? get readTarget => - isAugmenting ? _origin!.readTarget : _introductory.readTarget; + Member? get readTarget => isAugmenting + ? + // Coverage-ignore(suite): Not run. + _origin!.readTarget + : _introductory.readTarget; @override // Coverage-ignore(suite): Not run. @@ -350,7 +387,17 @@ class SourceMethodBuilder extends SourceMemberBuilderImpl @override int computeDefaultTypes(ComputeDefaultTypeContext context, {required bool inErrorRecovery}) { - return _introductory.computeDefaultTypes(context); + int count = _introductory.computeDefaultTypes(context); + if (declarationBuilder == null) { + List? augmentations = _augmentations; + if (augmentations != null) { + for (SourceMethodBuilder augmentation in augmentations) { + count += augmentation.computeDefaultTypes(context, + inErrorRecovery: inErrorRecovery); + } + } + } + return count; } @override diff --git a/pkg/front_end/lib/src/source/source_property_builder.dart b/pkg/front_end/lib/src/source/source_property_builder.dart index 50ab4b82237..7502585442b 100644 --- a/pkg/front_end/lib/src/source/source_property_builder.dart +++ b/pkg/front_end/lib/src/source/source_property_builder.dart @@ -130,6 +130,7 @@ class SourcePropertyBuilder extends SourceMemberBuilderImpl Builder get parent => declarationBuilder ?? libraryBuilder; @override + // Coverage-ignore(suite): Not run. bool get isAugmentation => _modifiers.isAugment; @override @@ -163,18 +164,21 @@ class SourcePropertyBuilder extends SourceMemberBuilderImpl writeTarget as Annotatable ]; + // Coverage-ignore(suite): Not run. // TODO(johnniwinther): Remove this. This is only needed for detecting patches // and macro annotations and we should use the fragment directly once // augmentations are fragments. List? get metadata => _introductoryGetable?.metadata ?? - _introductorySetable - // Coverage-ignore(suite): Not run. - ?.metadata ?? + _introductorySetable?.metadata ?? _introductoryField?.metadata; @override - void applyAugmentation(Builder augmentation) { + void addAugmentation(Builder augmentation) { + _addAugmentation(augmentation); + } + + void _addAugmentation(Builder augmentation) { if (augmentation is SourcePropertyBuilder) { if (checkAugmentation( augmentationLibraryBuilder: augmentation.libraryBuilder, @@ -182,8 +186,11 @@ class SourcePropertyBuilder extends SourceMemberBuilderImpl augmentation: augmentation)) { augmentation._origin = this; if (augmentation.isSetter) { - SourcePropertyBuilder augmentedBuilder = - _setterAugmentations == null ? this : _setterAugmentations!.last; + SourcePropertyBuilder augmentedBuilder = _setterAugmentations == null + ? this + : + // Coverage-ignore(suite): Not run. + _setterAugmentations!.last; augmentation._augmentedBuilder = augmentedBuilder; augmentation._augmentationIndex = augmentedBuilder._augmentationIndex + 1; @@ -209,6 +216,12 @@ class SourcePropertyBuilder extends SourceMemberBuilderImpl } } + @override + // Coverage-ignore(suite): Not run. + void applyAugmentation(Builder augmentation) { + _addAugmentation(augmentation); + } + @override SourcePropertyBuilder get origin => _origin ?? this; @@ -234,6 +247,7 @@ class SourcePropertyBuilder extends SourceMemberBuilderImpl Map _augmentedProcedures = {}; + // Coverage-ignore(suite): Not run. AugmentSuperTarget? _createAugmentSuperTarget( SourcePropertyBuilder? targetBuilder) { if (targetBuilder == null) return null; @@ -243,7 +257,6 @@ class SourcePropertyBuilder extends SourceMemberBuilderImpl if (declaredSetter == null) return null; if (declaredSetter.isAbstract || declaredSetter.isExternal) { - // Coverage-ignore-block(suite): Not run. return targetBuilder._augmentedBuilder != null ? _getAugmentSuperTarget(targetBuilder._augmentedBuilder!) : null; @@ -272,7 +285,6 @@ class SourcePropertyBuilder extends SourceMemberBuilderImpl if (declaredGetter == null) return null; if (declaredGetter.isAbstract || declaredGetter.isExternal) { - // Coverage-ignore-block(suite): Not run. return targetBuilder._augmentedBuilder != null ? _getAugmentSuperTarget(targetBuilder._augmentedBuilder!) : null; @@ -298,6 +310,7 @@ class SourcePropertyBuilder extends SourceMemberBuilderImpl } } + // Coverage-ignore(suite): Not run. AugmentSuperTarget? _getAugmentSuperTarget( SourcePropertyBuilder augmentation) { return _augmentedProcedures[augmentation] ??= @@ -305,6 +318,7 @@ class SourcePropertyBuilder extends SourceMemberBuilderImpl } @override + // Coverage-ignore(suite): Not run. AugmentSuperTarget? get augmentSuperTarget => origin._getAugmentSuperTarget(this); @@ -315,6 +329,7 @@ class SourcePropertyBuilder extends SourceMemberBuilderImpl void addAugmentedProcedure(SourcePropertyBuilder builder) { Procedure? augmentedGetter = builder._augmentedGetter; if (augmentedGetter != null) { + // Coverage-ignore-block(suite): Not run. augmentedGetter ..fileOffset = builder._introductoryGetable!.readTarget.fileOffset ..fileEndOffset = @@ -342,6 +357,7 @@ class SourcePropertyBuilder extends SourceMemberBuilderImpl void addAugmentedProcedure(SourcePropertyBuilder builder) { Procedure? augmentedSetter = builder._augmentedSetter; if (augmentedSetter != null) { + // Coverage-ignore-block(suite): Not run. augmentedSetter ..fileOffset = builder._introductorySetable!.writeTarget.fileOffset ..fileEndOffset = @@ -378,6 +394,28 @@ class SourcePropertyBuilder extends SourceMemberBuilderImpl _introductorySetable?.buildOutlineNode( libraryBuilder, _nameScheme, f, _references as SetterReference, classTypeParameters: classBuilder?.cls.typeParameters); + List? getterAugmentations = _getterAugmentations; + if (getterAugmentations != null) { + for (SourcePropertyBuilder augmentation in getterAugmentations) { + augmentation.buildOutlineNodes(( + {required Member member, + Member? tearOff, + required BuiltMemberKind kind}) { + // Don't add augmentations. + }); + } + } + List? setterAugmentations = _setterAugmentations; + if (setterAugmentations != null) { + for (SourcePropertyBuilder augmentation in setterAugmentations) { + augmentation.buildOutlineNodes(( + {required Member member, + Member? tearOff, + required BuiltMemberKind kind}) { + // Don't add augmentations. + }); + } + } } bool hasBuiltOutlineExpressions = false; @@ -405,6 +443,20 @@ class SourcePropertyBuilder extends SourceMemberBuilderImpl libraryBuilder, declarationBuilder, writeTarget as Annotatable, isClassInstanceMember: isClassInstanceMember, createFileUriExpression: isAugmented); + List? getterAugmentations = _getterAugmentations; + if (getterAugmentations != null) { + for (SourcePropertyBuilder augmentation in getterAugmentations) { + augmentation.buildOutlineExpressions( + classHierarchy, delayedDefaultValueCloners); + } + } + List? setterAugmentations = _setterAugmentations; + if (setterAugmentations != null) { + for (SourcePropertyBuilder augmentation in setterAugmentations) { + augmentation.buildOutlineExpressions( + classHierarchy, delayedDefaultValueCloners); + } + } hasBuiltOutlineExpressions = true; } } @@ -536,6 +588,20 @@ class SourcePropertyBuilder extends SourceMemberBuilderImpl if (_introductorySetable != null) { count += _introductorySetable!.computeDefaultTypes(context); } + List? getterAugmentations = _getterAugmentations; + if (getterAugmentations != null) { + for (SourcePropertyBuilder augmentation in getterAugmentations) { + count += augmentation.computeDefaultTypes(context, + inErrorRecovery: inErrorRecovery); + } + } + List? setterAugmentations = _setterAugmentations; + if (setterAugmentations != null) { + for (SourcePropertyBuilder augmentation in setterAugmentations) { + count += augmentation.computeDefaultTypes(context, + inErrorRecovery: inErrorRecovery); + } + } return count; } diff --git a/pkg/front_end/lib/src/source/type_parameter_scope_builder.dart b/pkg/front_end/lib/src/source/type_parameter_scope_builder.dart index ea944d056b9..af206fd6a14 100644 --- a/pkg/front_end/lib/src/source/type_parameter_scope_builder.dart +++ b/pkg/front_end/lib/src/source/type_parameter_scope_builder.dart @@ -32,6 +32,7 @@ import 'source_extension_type_declaration_builder.dart'; import 'source_factory_builder.dart'; import 'source_library_builder.dart'; import 'source_loader.dart'; +import 'source_member_builder.dart'; import 'source_method_builder.dart'; import 'source_property_builder.dart'; import 'source_type_alias_builder.dart'; @@ -204,7 +205,6 @@ class _PropertyPreBuilder extends _PreBuilder { } } else { if (fragmentName.isAugment) { - // Coverage-ignore-block(suite): Not run. // Example: // // int get foo => 42; @@ -760,7 +760,6 @@ class _ConstructorPreBuilder extends _PreBuilder { bool absorbFragment( ProblemReporting problemReporting, _FragmentName fragmentName) { if (fragmentName.isAugment) { - // Coverage-ignore-block(suite): Not run. if (fragmentName.kind == fragment.kind) { // Example: // @@ -860,7 +859,6 @@ class _ConstructorPreBuilder extends _PreBuilder { void Function(Fragment, {bool conflictingSetter}) createBuilder) { createBuilder(fragment.fragment); for (_FragmentName fragmentName in augmentations) { - // Coverage-ignore-block(suite): Not run. createBuilder(fragmentName.fragment); } } @@ -1229,7 +1227,8 @@ void _computeBuildersFromFragments(String name, List fragments, fragment: fragment, reference: reference); builders.add(new _AddBuilder(fragment.name, typedefBuilder, - fragment.fileUri, fragment.nameOffset)); + fragment.fileUri, fragment.nameOffset, + inPatch: fragment.enclosingCompilationUnit.isPatch)); if (reference != null) { loader.buildersCreatedWithReferences[reference] = typedefBuilder; } @@ -1250,8 +1249,9 @@ void _computeBuildersFromFragments(String name, List fragments, classDeclaration: new RegularClassDeclaration(fragment)); fragment.builder = classBuilder; fragment.bodyScope.declarationBuilder = classBuilder; - builders.add(new _AddBuilder(fragment.name, classBuilder, - fragment.fileUri, fragment.fileOffset)); + builders.add(new _AddBuilder( + fragment.name, classBuilder, fragment.fileUri, fragment.fileOffset, + inPatch: fragment.enclosingCompilationUnit.isPatch)); if (indexedClass != null) { loader.buildersCreatedWithReferences[indexedClass.reference] = classBuilder; @@ -1275,8 +1275,9 @@ void _computeBuildersFromFragments(String name, List fragments, classDeclaration: new MixinDeclaration(fragment)); fragment.builder = mixinBuilder; fragment.bodyScope.declarationBuilder = mixinBuilder; - builders.add(new _AddBuilder(fragment.name, mixinBuilder, - fragment.fileUri, fragment.fileOffset)); + builders.add(new _AddBuilder( + fragment.name, mixinBuilder, fragment.fileUri, fragment.fileOffset, + inPatch: fragment.enclosingCompilationUnit.isPatch)); if (indexedClass != null) { loader.buildersCreatedWithReferences[indexedClass.reference] = mixinBuilder; @@ -1313,8 +1314,9 @@ void _computeBuildersFromFragments(String name, List fragments, classDeclaration: classDeclaration); mixinApplications[classBuilder] = mixin; fragment.builder = classBuilder; - builders.add(new _AddBuilder(fragment.name, classBuilder, - fragment.fileUri, fragment.nameOffset)); + builders.add(new _AddBuilder( + fragment.name, classBuilder, fragment.fileUri, fragment.nameOffset, + inPatch: fragment.enclosingCompilationUnit.isPatch)); if (referencesFromIndexedClass != null) { loader.buildersCreatedWithReferences[ referencesFromIndexedClass.reference] = classBuilder; @@ -1344,7 +1346,8 @@ void _computeBuildersFromFragments(String name, List fragments, fragment.builder = enumBuilder; fragment.bodyScope.declarationBuilder = enumBuilder; builders.add(new _AddBuilder( - fragment.name, enumBuilder, fragment.fileUri, fragment.fileOffset)); + fragment.name, enumBuilder, fragment.fileUri, fragment.fileOffset, + inPatch: fragment.enclosingCompilationUnit.isPatch)); if (indexedClass != null) { loader.buildersCreatedWithReferences[indexedClass.reference] = enumBuilder; @@ -1363,7 +1366,8 @@ void _computeBuildersFromFragments(String name, List fragments, fragment: fragment, reference: reference); builders.add(new _AddBuilder(fragment.name, extensionBuilder, - fragment.fileUri, fragment.fileOffset)); + fragment.fileUri, fragment.fileOffset, + inPatch: fragment.enclosingCompilationUnit.isPatch)); if (reference != null) { loader.buildersCreatedWithReferences[reference] = extensionBuilder; } @@ -1392,7 +1396,8 @@ void _computeBuildersFromFragments(String name, List fragments, fragment.name, extensionTypeDeclarationBuilder, fragment.fileUri, - fragment.fileOffset)); + fragment.fileOffset, + inPatch: fragment.enclosingCompilationUnit.isPatch)); case FieldFragment(): String name = fragment.name; @@ -1436,7 +1441,9 @@ void _computeBuildersFromFragments(String name, List fragments, references: references); fragment.builder = propertyBuilder; builders.add(new _AddBuilder(fragment.name, propertyBuilder, - fragment.fileUri, fragment.nameOffset)); + fragment.fileUri, fragment.nameOffset, + inPatch: fragment.enclosingDeclaration?.isPatch ?? + fragment.enclosingCompilationUnit.isPatch)); references.registerReference(loader, propertyBuilder); case GetterFragment(): String name = fragment.name; @@ -1458,6 +1465,7 @@ void _computeBuildersFromFragments(String name, List fragments, indexedContainer ??= indexedLibrary; bool isAugmentation = enclosingLibraryBuilder.isAugmenting && + // Coverage-ignore(suite): Not run. fragment.modifiers.isAugment; GetterReference references = new GetterReference( @@ -1477,7 +1485,9 @@ void _computeBuildersFromFragments(String name, List fragments, fragment.setBuilder(problemReporting, propertyBuilder, propertyEncodingStrategy, unboundNominalParameters); builders.add(new _AddBuilder(fragment.name, propertyBuilder, - fragment.fileUri, fragment.nameOffset)); + fragment.fileUri, fragment.nameOffset, + inPatch: fragment.enclosingDeclaration?.isPatch ?? + fragment.enclosingCompilationUnit.isPatch)); references.registerReference(loader, propertyBuilder); case SetterFragment(): String name = fragment.name; @@ -1499,6 +1509,7 @@ void _computeBuildersFromFragments(String name, List fragments, indexedContainer ??= indexedLibrary; bool isAugmentation = enclosingLibraryBuilder.isAugmenting && + // Coverage-ignore(suite): Not run. fragment.modifiers.isAugment; SetterReference references = new SetterReference( @@ -1518,7 +1529,9 @@ void _computeBuildersFromFragments(String name, List fragments, fragment.setBuilder(problemReporting, propertyBuilder, propertyEncodingStrategy, unboundNominalParameters); builders.add(new _AddBuilder(fragment.name, propertyBuilder, - fragment.fileUri, fragment.nameOffset)); + fragment.fileUri, fragment.nameOffset, + inPatch: fragment.enclosingDeclaration?.isPatch ?? + fragment.enclosingCompilationUnit.isPatch)); references.registerReference(loader, propertyBuilder); if (conflictingSetter) { propertyBuilder.isConflictingSetter = true; @@ -1552,6 +1565,7 @@ void _computeBuildersFromFragments(String name, List fragments, indexedContainer ??= indexedLibrary; bool isAugmentation = enclosingLibraryBuilder.isAugmenting && + // Coverage-ignore(suite): Not run. fragment.modifiers.isAugment; if (indexedContainer != null && !isAugmentation) { Name nameToLookup = @@ -1579,8 +1593,10 @@ void _computeBuildersFromFragments(String name, List fragments, tearOffReference: tearOffReference); fragment.setBuilder(problemReporting, methodBuilder, encodingStrategy, unboundNominalParameters); - builders.add(new _AddBuilder(fragment.name, methodBuilder, - fragment.fileUri, fragment.nameOffset)); + builders.add(new _AddBuilder( + fragment.name, methodBuilder, fragment.fileUri, fragment.nameOffset, + inPatch: fragment.enclosingDeclaration?.isPatch ?? + fragment.enclosingCompilationUnit.isPatch)); if (procedureReference != null) { loader.buildersCreatedWithReferences[procedureReference] = methodBuilder; @@ -1614,7 +1630,10 @@ void _computeBuildersFromFragments(String name, List fragments, ?.builders; NominalParameterCopy? nominalVariableCopy = NominalParameterCopy.copyTypeParameters( - unboundNominalParameters, declarationBuilder.typeParameters, + unboundNominalParameters: unboundNominalParameters, + oldParameterBuilders: declarationBuilder.typeParameters, + oldParameterFragments: + fragment.enclosingDeclaration.typeParameters, kind: TypeParameterKind.extensionSynthesized, instanceTypeParameterAccess: InstanceTypeParameterAccessState.Allowed); @@ -1698,7 +1717,10 @@ void _computeBuildersFromFragments(String name, List fragments, ?.builders; NominalParameterCopy? nominalVariableCopy = NominalParameterCopy.copyTypeParameters( - unboundNominalParameters, declarationBuilder.typeParameters, + unboundNominalParameters: unboundNominalParameters, + oldParameterBuilders: declarationBuilder.typeParameters, + oldParameterFragments: + fragment.enclosingDeclaration.typeParameters, kind: TypeParameterKind.extensionSynthesized, instanceTypeParameterAccess: InstanceTypeParameterAccessState.Allowed); @@ -1733,7 +1755,8 @@ void _computeBuildersFromFragments(String name, List fragments, } fragment.builder = constructorBuilder; builders.add(new _AddBuilder(fragment.name, constructorBuilder, - fragment.fileUri, fragment.fullNameOffset)); + fragment.fileUri, fragment.fullNameOffset, + inPatch: fragment.enclosingDeclaration.isPatch)); // TODO(johnniwinther): There is no way to pass the tear off reference // here. @@ -1767,7 +1790,10 @@ void _computeBuildersFromFragments(String name, List fragments, case ExtensionTypeDeclarationBuilder(): NominalParameterCopy? nominalVariableCopy = NominalParameterCopy.copyTypeParameters( - unboundNominalParameters, declarationBuilder.typeParameters, + unboundNominalParameters: unboundNominalParameters, + oldParameterBuilders: declarationBuilder.typeParameters, + oldParameterFragments: + fragment.enclosingDeclaration.typeParameters, kind: TypeParameterKind.extensionSynthesized, instanceTypeParameterAccess: InstanceTypeParameterAccessState.Allowed); @@ -1816,7 +1842,8 @@ void _computeBuildersFromFragments(String name, List fragments, } fragment.builder = constructorBuilder; builders.add(new _AddBuilder(fragment.name, constructorBuilder, - fragment.fileUri, fragment.fileOffset)); + fragment.fileUri, fragment.fileOffset, + inPatch: fragment.enclosingDeclaration.isPatch)); // TODO(johnniwinther): There is no way to pass the tear off reference // here. @@ -1828,7 +1855,10 @@ void _computeBuildersFromFragments(String name, List fragments, String name = fragment.name; NominalParameterCopy? nominalParameterCopy = NominalParameterCopy.copyTypeParameters( - unboundNominalParameters, declarationBuilder!.typeParameters, + unboundNominalParameters: unboundNominalParameters, + oldParameterBuilders: declarationBuilder!.typeParameters, + oldParameterFragments: + fragment.enclosingDeclaration.typeParameters, kind: TypeParameterKind.function, instanceTypeParameterAccess: InstanceTypeParameterAccessState.Allowed); @@ -1903,7 +1933,8 @@ void _computeBuildersFromFragments(String name, List fragments, } fragment.builder = factoryBuilder; builders.add(new _AddBuilder(fragment.name, factoryBuilder, - fragment.fileUri, fragment.fullNameOffset)); + fragment.fileUri, fragment.fullNameOffset, + inPatch: fragment.enclosingDeclaration.isPatch)); // TODO(johnniwinther): There is no way to pass the tear off reference // here. if (procedureReference != null) { @@ -1936,7 +1967,8 @@ void _computeBuildersFromFragments(String name, List fragments, references: references); fragment.builder = propertyBuilder; builders.add(new _AddBuilder(fragment.name, propertyBuilder, - fragment.fileUri, fragment.nameOffset)); + fragment.fileUri, fragment.nameOffset, + inPatch: fragment.enclosingDeclaration.isPatch)); } } @@ -1966,6 +1998,12 @@ class LibraryNameSpaceBuilder { _fragments.addAll(other._fragments); } + bool _allowInjectedPublicMember( + SourceLibraryBuilder enclosingLibraryBuilder, Builder newBuilder) { + return enclosingLibraryBuilder.importUri.isScheme("dart") && + enclosingLibraryBuilder.importUri.path.startsWith("_"); + } + NameSpace toNameSpace({ required SourceLibraryBuilder enclosingLibraryBuilder, required IndexedLibrary? indexedLibrary, @@ -1982,8 +2020,11 @@ class LibraryNameSpaceBuilder { NameSpace nameSpace = new NameSpaceImpl( getables: getables, setables: setables, extensions: extensions); - void _addBuilder( - String name, Builder declaration, Uri fileUri, int charOffset) { + void _addBuilder(_AddBuilder addBuilder) { + String name = addBuilder.name; + Builder declaration = addBuilder.declaration; + Uri fileUri = addBuilder.fileUri; + int charOffset = addBuilder.charOffset; if (declaration is SourceExtensionBuilder && declaration.isUnnamedExtension) { extensions.add(declaration); @@ -2014,6 +2055,49 @@ class LibraryNameSpaceBuilder { if (existing == declaration) return; + if (declaration.isAugment) { + if (existing != null) { + existing.addAugmentation(declaration); + return; + } else { + if (addBuilder.inPatch) { + Message message; + if (declaration is SourceMemberBuilder) { + message = addBuilder.inPatch + ? templateUnmatchedPatchLibraryMember.withArguments(name) + : + // Coverage-ignore(suite): Not run. + templateUnmatchedAugmentationLibraryMember + .withArguments(name); + } else if (declaration is SourceClassBuilder) { + message = addBuilder.inPatch + ? templateUnmatchedPatchClass.withArguments(name) + : + // Coverage-ignore(suite): Not run. + templateUnmatchedAugmentationClass.withArguments(name); + } else { + message = addBuilder.inPatch + ? templateUnmatchedPatchDeclaration.withArguments(name) + : + // Coverage-ignore(suite): Not run. + templateUnmatchedAugmentationDeclaration.withArguments(name); + } + problemReporting.addProblem(message, charOffset, noLength, fileUri); + } + } + } + + if (addBuilder.inPatch && + !name.startsWith('_') && + !_allowInjectedPublicMember(enclosingLibraryBuilder, declaration)) { + problemReporting.addProblem( + templatePatchInjectionFailed.withArguments( + name, enclosingLibraryBuilder.importUri), + charOffset, + noLength, + fileUri); + } + if (declaration.next != null && // Coverage-ignore(suite): Not run. declaration.next != existing) { @@ -2034,6 +2118,7 @@ class LibraryNameSpaceBuilder { // output. extensions.add(declaration as SourceExtensionBuilder); } else if (declaration.isAugment) { + // Coverage-ignore-block(suite): Not run. if (existing != null) { if (declaration.isSetter) { (setterAugmentations[name] ??= []).add(declaration); @@ -2064,8 +2149,7 @@ class LibraryNameSpaceBuilder { indexedLibrary: indexedLibrary, containerType: ContainerType.Library); for (_AddBuilder addBuilder in addBuilders) { - _addBuilder(addBuilder.name, addBuilder.declaration, addBuilder.fileUri, - addBuilder.charOffset); + _addBuilder(addBuilder); } } return nameSpace; @@ -2146,6 +2230,7 @@ abstract class DeclarationFragmentImpl implements DeclarationFragment { final DeclarationBuilderScope bodyScope; final List _fragments = []; + @override final List? typeParameters; final NominalParameterNameSpace _nominalParameterNameSpace; @@ -2196,8 +2281,10 @@ class _AddBuilder { final Builder declaration; final Uri fileUri; final int charOffset; + final bool inPatch; - _AddBuilder(this.name, this.declaration, this.fileUri, this.charOffset); + _AddBuilder(this.name, this.declaration, this.fileUri, this.charOffset, + {required this.inPatch}); } class DeclarationNameSpaceBuilder { @@ -2213,57 +2300,22 @@ class DeclarationNameSpaceBuilder { DeclarationNameSpaceBuilder._( this._name, this._nominalParameterNameSpace, this._fragments); - void _addBuilder( - ProblemReporting problemReporting, - Map getables, - Map setables, - Map constructors, - _AddBuilder addBuilder) { - String name = addBuilder.name; - Builder declaration = addBuilder.declaration; - Uri fileUri = addBuilder.fileUri; - int charOffset = addBuilder.charOffset; + void includeBuilders(DeclarationNameSpaceBuilder other) { + _fragments.addAll(other._fragments); + other._fragments.clear(); + } - bool isConstructor = declaration is FunctionBuilder && - (declaration.isConstructor || declaration.isFactory); - if (!isConstructor && name == _name) { - problemReporting.addProblem( - messageMemberWithSameNameAsClass, charOffset, noLength, fileUri); + bool _allowInjectedPublicMember( + SourceLibraryBuilder enclosingLibraryBuilder, Builder newBuilder) { + if (enclosingLibraryBuilder.importUri.isScheme("dart") && + enclosingLibraryBuilder.importUri.path.startsWith("_")) { + return true; } - Map members = isConstructor - ? constructors - : (declaration.isSetter ? setables : getables); - - Builder? existing = members[name]; - - if (existing == declaration) return; - - if (declaration.next != null && - // Coverage-ignore(suite): Not run. - declaration.next != existing) { - unexpected( - "${declaration.next!.fileUri}@${declaration.next!.fileOffset}", - "${existing?.fileUri}@${existing?.fileOffset}", - declaration.fileOffset, - declaration.fileUri); + if (newBuilder.isStatic) { + return _name.startsWith('_'); } - declaration.next = existing; - if (isDuplicatedDeclaration(existing, declaration)) { - // Error reporting in [_computeBuildersFromFragments]. - // TODO(johnniwinther): Avoid the use of [isDuplicatedDeclaration]. - } else if (declaration.isAugment) { - // Coverage-ignore-block(suite): Not run. - if (existing != null) { - if (declaration.isSetter) { - // TODO(johnniwinther): Collection augment setables. - } else { - // TODO(johnniwinther): Collection augment getables. - } - } else { - // TODO(cstefantsova): Report an error. - } - } - members[name] = declaration; + // TODO(johnniwinther): Restrict the use of injected public class members. + return true; } void checkTypeParameterConflict(ProblemReporting _problemReporting, @@ -2305,6 +2357,87 @@ class DeclarationNameSpaceBuilder { (fragmentsByName[fragment.name] ??= []).add(fragment); } + void _addBuilder(_AddBuilder addBuilder) { + String name = addBuilder.name; + Builder declaration = addBuilder.declaration; + Uri fileUri = addBuilder.fileUri; + int charOffset = addBuilder.charOffset; + + bool isConstructor = declaration is FunctionBuilder && + (declaration.isConstructor || declaration.isFactory); + if (!isConstructor && name == _name) { + problemReporting.addProblem( + messageMemberWithSameNameAsClass, charOffset, noLength, fileUri); + } + Map members = isConstructor + ? constructors + : (declaration.isSetter ? setables : getables); + + Builder? existing = members[name]; + + if (existing == declaration) return; + + if (declaration.isAugment) { + if (existing != null) { + existing.addAugmentation(declaration); + return; + } else { + Message message; + if (declaration is SourceMemberBuilder) { + message = addBuilder.inPatch + ? templateUnmatchedPatchClassMember.withArguments(name) + : + // Coverage-ignore(suite): Not run. + templateUnmatchedAugmentationClassMember.withArguments(name); + } else { + // Coverage-ignore-block(suite): Not run. + message = addBuilder.inPatch + ? templateUnmatchedPatchDeclaration.withArguments(name) + : templateUnmatchedAugmentationDeclaration.withArguments(name); + } + problemReporting.addProblem(message, charOffset, noLength, fileUri); + } + } + + if (addBuilder.inPatch && + !name.startsWith('_') && + !_allowInjectedPublicMember(enclosingLibraryBuilder, declaration)) { + problemReporting.addProblem( + templatePatchInjectionFailed.withArguments( + name, enclosingLibraryBuilder.importUri), + charOffset, + noLength, + fileUri); + } + + if (declaration.next != null && + // Coverage-ignore(suite): Not run. + declaration.next != existing) { + unexpected( + "${declaration.next!.fileUri}@${declaration.next!.fileOffset}", + "${existing?.fileUri}@${existing?.fileOffset}", + declaration.fileOffset, + declaration.fileUri); + } + declaration.next = existing; + if (isDuplicatedDeclaration(existing, declaration)) { + // Error reporting in [_computeBuildersFromFragments]. + // TODO(johnniwinther): Avoid the use of [isDuplicatedDeclaration]. + } else if (declaration.isAugment) { + // Coverage-ignore-block(suite): Not run. + if (existing != null) { + if (declaration.isSetter) { + // TODO(johnniwinther): Collection augment setables. + } else { + // TODO(johnniwinther): Collection augment getables. + } + } else { + // TODO(cstefantsova): Report an error. + } + } + members[name] = declaration; + } + for (MapEntry> entry in fragmentsByName.entries) { List<_AddBuilder> addBuilders = []; _computeBuildersFromFragments(entry.key, entry.value, @@ -2321,8 +2454,7 @@ class DeclarationNameSpaceBuilder { containerType: containerType, containerName: containerName); for (_AddBuilder addBuilder in addBuilders) { - _addBuilder( - problemReporting, getables, setables, constructors, addBuilder); + _addBuilder(addBuilder); } } diff --git a/pkg/front_end/lib/src/type_inference/inference_visitor.dart b/pkg/front_end/lib/src/type_inference/inference_visitor.dart index 93eed0e4860..27808a70050 100644 --- a/pkg/front_end/lib/src/type_inference/inference_visitor.dart +++ b/pkg/front_end/lib/src/type_inference/inference_visitor.dart @@ -5542,6 +5542,7 @@ class InferenceVisitorImpl extends InferenceVisitorBase isExpressionInvocation: false, isImplicitCall: false); } + // Coverage-ignore(suite): Not run. ExpressionInferenceResult visitAugmentSuperInvocation( AugmentSuperInvocation node, DartType typeContext) { Member member = node.target; @@ -5581,7 +5582,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase return new ExpressionInferenceResult( result.inferredType, result.applyResult(invocation)); } else { - // Coverage-ignore-block(suite): Not run. // TODO(johnniwinther): Handle augmentation of field with inferred types. TypeInferenceEngine.resolveInferenceNode(member, hierarchyBuilder); DartType receiverType = member.getterType; @@ -8252,6 +8252,7 @@ class InferenceVisitorImpl extends InferenceVisitorBase return new ExpressionInferenceResult(replacementType, replacement); } + // Coverage-ignore(suite): Not run. ExpressionInferenceResult visitAugmentSuperSet( AugmentSuperSet node, DartType typeContext) { Member member = node.target; @@ -8262,11 +8263,8 @@ class InferenceVisitorImpl extends InferenceVisitorBase ObjectAccessTarget target = new ObjectAccessTarget.interfaceMember( thisType!, member, hasNonObjectMemberAccess: true); - if (target.isInstanceMember || - // Coverage-ignore(suite): Not run. - target.isObjectMember) { + if (target.isInstanceMember || target.isObjectMember) { if (instrumentation != null && receiverType == const DynamicType()) { - // Coverage-ignore-block(suite): Not run. instrumentation!.record(uriForInstrumentation, node.fileOffset, 'target', new InstrumentationValueForMember(target.member!)); } @@ -8505,6 +8503,7 @@ class InferenceVisitorImpl extends InferenceVisitorBase } } + // Coverage-ignore(suite): Not run. ExpressionInferenceResult visitAugmentSuperGet( AugmentSuperGet node, DartType typeContext) { Member member = node.target; diff --git a/pkg/front_end/messages.status b/pkg/front_end/messages.status index 4fd1fa06c48..caab3377044 100644 --- a/pkg/front_end/messages.status +++ b/pkg/front_end/messages.status @@ -943,6 +943,8 @@ PatchClassTypeParametersMismatch/analyzerCode: Fail PatchClassTypeParametersMismatch/example: Fail PatchDeclarationMismatch/analyzerCode: Fail PatchDeclarationMismatch/example: Fail +PatchExtensionTypeParametersMismatch/analyzerCode: Fail +PatchExtensionTypeParametersMismatch/example: Fail PatchInjectionFailed/analyzerCode: Fail PatchInjectionFailed/example: Fail PatchNonExternal/analyzerCode: Fail diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml index cd4ad463429..3dd5aeeab8e 100644 --- a/pkg/front_end/messages.yaml +++ b/pkg/front_end/messages.yaml @@ -4168,6 +4168,13 @@ PatchClassOrigin: problemMessage: "This is the origin class." severity: CONTEXT +PatchExtensionTypeParametersMismatch: + problemMessage: "A patch extension must have the same number of type variables as its origin extension." + +PatchExtensionOrigin: + problemMessage: "This is the origin extension." + severity: CONTEXT + PatchDeclarationMismatch: problemMessage: "This patch doesn't match origin declaration." diff --git a/pkg/front_end/test/coverage_suite_expected.dart b/pkg/front_end/test/coverage_suite_expected.dart index 6d9b53d4fce..ec1472a5dbb 100644 --- a/pkg/front_end/test/coverage_suite_expected.dart +++ b/pkg/front_end/test/coverage_suite_expected.dart @@ -150,7 +150,7 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/base/incremental_compiler.dart": ( - hitCount: 828, + hitCount: 850, missCount: 0, ), // 100.0%. @@ -185,7 +185,7 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/base/modifiers.dart": ( - hitCount: 130, + hitCount: 128, missCount: 0, ), // 100.0%. @@ -210,7 +210,7 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/base/scope.dart": ( - hitCount: 671, + hitCount: 455, missCount: 0, ), // 100.0%. @@ -255,7 +255,7 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/builder/class_builder.dart": ( - hitCount: 137, + hitCount: 135, missCount: 0, ), // 100.0%. @@ -265,7 +265,7 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/builder/declaration_builder.dart": ( - hitCount: 28, + hitCount: 26, missCount: 0, ), // 100.0%. @@ -370,7 +370,7 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/builder/synthesized_type_builder.dart": ( - hitCount: 124, + hitCount: 122, missCount: 0, ), // 100.0%. @@ -465,12 +465,12 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/fragment/class.dart": ( - hitCount: 6, + hitCount: 11, missCount: 0, ), // 100.0%. "package:front_end/src/fragment/class/declaration.dart": ( - hitCount: 171, + hitCount: 168, missCount: 0, ), // 100.0%. @@ -480,7 +480,7 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/fragment/constructor/declaration.dart": ( - hitCount: 315, + hitCount: 312, missCount: 0, ), // 100.0%. @@ -490,7 +490,7 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/fragment/enum.dart": ( - hitCount: 10, + hitCount: 13, missCount: 0, ), // 100.0%. @@ -500,12 +500,12 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/fragment/extension.dart": ( - hitCount: 13, + hitCount: 18, missCount: 0, ), // 100.0%. "package:front_end/src/fragment/extension_type.dart": ( - hitCount: 10, + hitCount: 13, missCount: 0, ), // 100.0%. @@ -535,17 +535,17 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/fragment/getter.dart": ( - hitCount: 537, + hitCount: 530, missCount: 0, ), // 100.0%. "package:front_end/src/fragment/method.dart": ( - hitCount: 783, + hitCount: 781, missCount: 0, ), // 100.0%. "package:front_end/src/fragment/mixin.dart": ( - hitCount: 6, + hitCount: 9, missCount: 0, ), // 100.0%. @@ -560,7 +560,7 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/fragment/setter.dart": ( - hitCount: 557, + hitCount: 550, missCount: 0, ), // 100.0%. @@ -575,12 +575,12 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/fragment/util.dart": ( - hitCount: 117, + hitCount: 127, missCount: 0, ), // 100.0%. "package:front_end/src/kernel/augmentation_lowering.dart": ( - hitCount: 4, + hitCount: 0, missCount: 0, ), // 100.0%. @@ -590,12 +590,12 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/kernel/body_builder.dart": ( - hitCount: 7216, + hitCount: 7205, missCount: 0, ), // 100.0%. "package:front_end/src/kernel/body_builder_context.dart": ( - hitCount: 289, + hitCount: 281, missCount: 0, ), // 100.0%. @@ -650,7 +650,7 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/kernel/expression_generator.dart": ( - hitCount: 2525, + hitCount: 2480, missCount: 0, ), // 100.0%. @@ -720,7 +720,7 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/kernel/internal_ast.dart": ( - hitCount: 571, + hitCount: 551, missCount: 0, ), // 100.0%. @@ -740,7 +740,7 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/kernel/kernel_target.dart": ( - hitCount: 1043, + hitCount: 1044, missCount: 0, ), // 100.0%. @@ -810,17 +810,17 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/source/builder_factory.dart": ( - hitCount: 63, + hitCount: 69, missCount: 0, ), // 100.0%. "package:front_end/src/source/class_declaration.dart": ( - hitCount: 104, + hitCount: 110, missCount: 0, ), // 100.0%. "package:front_end/src/source/diet_listener.dart": ( - hitCount: 647, + hitCount: 646, missCount: 0, ), // 100.0%. @@ -840,7 +840,7 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/source/outline_builder.dart": ( - hitCount: 2114, + hitCount: 2109, missCount: 0, ), // 100.0%. @@ -850,7 +850,7 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/source/source_builder_factory.dart": ( - hitCount: 1158, + hitCount: 1190, missCount: 0, ), // 100.0%. @@ -860,17 +860,17 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/source/source_class_builder.dart": ( - hitCount: 1402, + hitCount: 1399, missCount: 0, ), // 100.0%. "package:front_end/src/source/source_compilation_unit.dart": ( - hitCount: 658, + hitCount: 674, missCount: 0, ), // 100.0%. "package:front_end/src/source/source_constructor_builder.dart": ( - hitCount: 694, + hitCount: 699, missCount: 0, ), // 100.0%. @@ -880,48 +880,48 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/source/source_extension_builder.dart": ( - hitCount: 134, + hitCount: 159, missCount: 0, ), // 100.0%. "package:front_end/src/source/source_extension_type_declaration_builder.dart": ( - hitCount: 511, + hitCount: 514, missCount: 0, ), // 100.0%. "package:front_end/src/source/source_factory_builder.dart": ( - hitCount: 994, + hitCount: 1011, missCount: 0, ), // 100.0%. "package:front_end/src/source/source_function_builder.dart": ( - hitCount: 47, + hitCount: 46, missCount: 0, ), // 100.0%. "package:front_end/src/source/source_library_builder.dart": ( - hitCount: 1238, + hitCount: 1120, missCount: 0, ), // 100.0%. "package:front_end/src/source/source_loader.dart": ( - hitCount: 1844, + hitCount: 1819, missCount: 0, ), // 100.0%. "package:front_end/src/source/source_member_builder.dart": ( - hitCount: 14, + hitCount: 10, missCount: 0, ), // 100.0%. "package:front_end/src/source/source_method_builder.dart": ( - hitCount: 279, + hitCount: 229, missCount: 0, ), // 100.0%. "package:front_end/src/source/source_property_builder.dart": ( - hitCount: 767, + hitCount: 678, missCount: 0, ), // 100.0%. @@ -941,7 +941,7 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/source/type_parameter_scope_builder.dart": ( - hitCount: 1397, + hitCount: 1496, missCount: 0, ), // 100.0%. @@ -976,7 +976,7 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/type_inference/inference_visitor.dart": ( - hitCount: 8283, + hitCount: 8178, missCount: 0, ), // 100.0%. diff --git a/pkg/front_end/test/spell_checking_list_code.txt b/pkg/front_end/test/spell_checking_list_code.txt index b3c2dd3a106..2968e50c6e2 100644 --- a/pkg/front_end/test/spell_checking_list_code.txt +++ b/pkg/front_end/test/spell_checking_list_code.txt @@ -1472,6 +1472,7 @@ red redeclared redefine redirectee +redirections redirector redo reevaluation diff --git a/pkg/front_end/testcases/enhanced_parts/part_with_import_part.dart b/pkg/front_end/testcases/enhanced_parts/part_with_import_part.dart index b47f2ed6607..76556ab1714 100644 --- a/pkg/front_end/testcases/enhanced_parts/part_with_import_part.dart +++ b/pkg/front_end/testcases/enhanced_parts/part_with_import_part.dart @@ -8,4 +8,4 @@ import 'part_with_import_lib.dart'; method2() { foo(); // Ok -} \ No newline at end of file +} diff --git a/pkg/front_end/testcases/extensions/patch/main.dart.strong.expect b/pkg/front_end/testcases/extensions/patch/main.dart.strong.expect index 7c4343c41d2..257799596e3 100644 --- a/pkg/front_end/testcases/extensions/patch/main.dart.strong.expect +++ b/pkg/front_end/testcases/extensions/patch/main.dart.strong.expect @@ -1,12 +1,4 @@ library; -// -// Problems in library: -// -// pkg/front_end/testcases/extensions/patch/main.dart:9:5: Error: The method 'method2' isn't defined for the class 'int'. -// Try correcting the name to the name of an existing method, or defining a method named 'method2'. -// 0.method2(); -// ^^^^^^^ -// import self as self; import "dart:test" as test; @@ -14,21 +6,10 @@ import "dart:test"; static method test() → dynamic { test::IntExtension|method1(0); - invalid-expression "pkg/front_end/testcases/extensions/patch/main.dart:9:5: Error: The method 'method2' isn't defined for the class 'int'. -Try correcting the name to the name of an existing method, or defining a method named 'method2'. - 0.method2(); - ^^^^^^^" in 0{}.method2(); + test::IntExtension|method2(0); } library; -// -// Problems in library: -// -// pkg/front_end/testcases/extensions/patch/origin_lib.dart:11:5: Error: The method 'method2' isn't defined for the class 'int'. -// Try correcting the name to the name of an existing method, or defining a method named 'method2'. -// 0.method2(); -// ^^^^^^^ -// import self as test; import "dart:_internal" as _in; import "dart:core" as core; @@ -37,30 +18,47 @@ import "dart:_internal"; @#C1 extension IntExtension on core::int { - method method2 = test::IntExtension|method2; - method tearoff method2 = test::IntExtension|get#method2; method method1 = test::IntExtension|method1; method tearoff method1 = test::IntExtension|get#method1; + method method2 = test::IntExtension|method2; + method tearoff method2 = test::IntExtension|get#method2; +} +@#C1 +extension GenericExtension on T% { + method method3 = test::GenericExtension|method3; + method tearoff method3 = test::GenericExtension|get#method3; + method method4 = test::GenericExtension|method4; + method tearoff method4 = test::GenericExtension|get#method4; } @#C1 static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ IntExtension|method1(lowered final core::int #this) → core::int return 42; static extension-member method IntExtension|get#method1(lowered final core::int #this) → () → core::int return () → core::int => test::IntExtension|method1(#this); +@#C1 +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ GenericExtension|method3(lowered final test::GenericExtension|method3::T% #this) → core::int + return 42; +static extension-member method GenericExtension|get#method3(lowered final test::GenericExtension|get#method3::T% #this) → () → core::int + return () → core::int => test::GenericExtension|method3(#this); static method method1() → dynamic { test::IntExtension|method1(0); - invalid-expression "pkg/front_end/testcases/extensions/patch/origin_lib.dart:11:5: Error: The method 'method2' isn't defined for the class 'int'. -Try correcting the name to the name of an existing method, or defining a method named 'method2'. - 0.method2(); - ^^^^^^^" in 0{}.method2(); + test::IntExtension|method2(0); + test::GenericExtension|method3(0); + test::GenericExtension|method4(0); } static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ IntExtension|method2(lowered final core::int #this) → core::int return 43; static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ IntExtension|get#method2(lowered final core::int #this) → () → core::int return () → core::int => test::IntExtension|method2(#this); +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ GenericExtension|method4(lowered final test::GenericExtension|method4::T% #this) → core::int + return 43; +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ GenericExtension|get#method4(lowered final test::GenericExtension|get#method4::T% #this) → () → core::int + return () → core::int => test::GenericExtension|method4(#this); static method /* from org-dartlang-testcase:///patch_lib.dart */ _method2() → dynamic { test::IntExtension|method1(0); test::IntExtension|method2(0); + test::GenericExtension|method3(0); + test::GenericExtension|method4(0); } constants { diff --git a/pkg/front_end/testcases/extensions/patch/main.dart.strong.modular.expect b/pkg/front_end/testcases/extensions/patch/main.dart.strong.modular.expect index 7c4343c41d2..257799596e3 100644 --- a/pkg/front_end/testcases/extensions/patch/main.dart.strong.modular.expect +++ b/pkg/front_end/testcases/extensions/patch/main.dart.strong.modular.expect @@ -1,12 +1,4 @@ library; -// -// Problems in library: -// -// pkg/front_end/testcases/extensions/patch/main.dart:9:5: Error: The method 'method2' isn't defined for the class 'int'. -// Try correcting the name to the name of an existing method, or defining a method named 'method2'. -// 0.method2(); -// ^^^^^^^ -// import self as self; import "dart:test" as test; @@ -14,21 +6,10 @@ import "dart:test"; static method test() → dynamic { test::IntExtension|method1(0); - invalid-expression "pkg/front_end/testcases/extensions/patch/main.dart:9:5: Error: The method 'method2' isn't defined for the class 'int'. -Try correcting the name to the name of an existing method, or defining a method named 'method2'. - 0.method2(); - ^^^^^^^" in 0{}.method2(); + test::IntExtension|method2(0); } library; -// -// Problems in library: -// -// pkg/front_end/testcases/extensions/patch/origin_lib.dart:11:5: Error: The method 'method2' isn't defined for the class 'int'. -// Try correcting the name to the name of an existing method, or defining a method named 'method2'. -// 0.method2(); -// ^^^^^^^ -// import self as test; import "dart:_internal" as _in; import "dart:core" as core; @@ -37,30 +18,47 @@ import "dart:_internal"; @#C1 extension IntExtension on core::int { - method method2 = test::IntExtension|method2; - method tearoff method2 = test::IntExtension|get#method2; method method1 = test::IntExtension|method1; method tearoff method1 = test::IntExtension|get#method1; + method method2 = test::IntExtension|method2; + method tearoff method2 = test::IntExtension|get#method2; +} +@#C1 +extension GenericExtension on T% { + method method3 = test::GenericExtension|method3; + method tearoff method3 = test::GenericExtension|get#method3; + method method4 = test::GenericExtension|method4; + method tearoff method4 = test::GenericExtension|get#method4; } @#C1 static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ IntExtension|method1(lowered final core::int #this) → core::int return 42; static extension-member method IntExtension|get#method1(lowered final core::int #this) → () → core::int return () → core::int => test::IntExtension|method1(#this); +@#C1 +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ GenericExtension|method3(lowered final test::GenericExtension|method3::T% #this) → core::int + return 42; +static extension-member method GenericExtension|get#method3(lowered final test::GenericExtension|get#method3::T% #this) → () → core::int + return () → core::int => test::GenericExtension|method3(#this); static method method1() → dynamic { test::IntExtension|method1(0); - invalid-expression "pkg/front_end/testcases/extensions/patch/origin_lib.dart:11:5: Error: The method 'method2' isn't defined for the class 'int'. -Try correcting the name to the name of an existing method, or defining a method named 'method2'. - 0.method2(); - ^^^^^^^" in 0{}.method2(); + test::IntExtension|method2(0); + test::GenericExtension|method3(0); + test::GenericExtension|method4(0); } static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ IntExtension|method2(lowered final core::int #this) → core::int return 43; static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ IntExtension|get#method2(lowered final core::int #this) → () → core::int return () → core::int => test::IntExtension|method2(#this); +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ GenericExtension|method4(lowered final test::GenericExtension|method4::T% #this) → core::int + return 43; +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ GenericExtension|get#method4(lowered final test::GenericExtension|get#method4::T% #this) → () → core::int + return () → core::int => test::GenericExtension|method4(#this); static method /* from org-dartlang-testcase:///patch_lib.dart */ _method2() → dynamic { test::IntExtension|method1(0); test::IntExtension|method2(0); + test::GenericExtension|method3(0); + test::GenericExtension|method4(0); } constants { diff --git a/pkg/front_end/testcases/extensions/patch/main.dart.strong.outline.expect b/pkg/front_end/testcases/extensions/patch/main.dart.strong.outline.expect index e514945dd2e..10e204854f3 100644 --- a/pkg/front_end/testcases/extensions/patch/main.dart.strong.outline.expect +++ b/pkg/front_end/testcases/extensions/patch/main.dart.strong.outline.expect @@ -15,26 +15,43 @@ import "dart:_internal"; @_in::patch extension IntExtension on core::int { - method method2 = self2::IntExtension|method2; - method tearoff method2 = self2::IntExtension|get#method2; method method1 = self2::IntExtension|method1; method tearoff method1 = self2::IntExtension|get#method1; + method method2 = self2::IntExtension|method2; + method tearoff method2 = self2::IntExtension|get#method2; +} +@_in::patch +extension GenericExtension on T% { + method method3 = self2::GenericExtension|method3; + method tearoff method3 = self2::GenericExtension|get#method3; + method method4 = self2::GenericExtension|method4; + method tearoff method4 = self2::GenericExtension|get#method4; } @_in::patch external static extension-member method IntExtension|method1(lowered final core::int #this) → core::int; static extension-member method IntExtension|get#method1(lowered final core::int #this) → () → core::int return () → core::int => self2::IntExtension|method1(#this); +@_in::patch +external static extension-member method GenericExtension|method3(lowered final self2::GenericExtension|method3::T% #this) → core::int; +static extension-member method GenericExtension|get#method3(lowered final self2::GenericExtension|get#method3::T% #this) → () → core::int + return () → core::int => self2::GenericExtension|method3(#this); static method method1() → dynamic ; static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ IntExtension|method2(lowered final core::int #this) → core::int ; static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ IntExtension|get#method2(lowered final core::int #this) → () → core::int return () → core::int => self2::IntExtension|method2(#this); +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ GenericExtension|method4(lowered final self2::GenericExtension|method4::T% #this) → core::int + ; +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ GenericExtension|get#method4(lowered final self2::GenericExtension|get#method4::T% #this) → () → core::int + return () → core::int => self2::GenericExtension|method4(#this); static method /* from org-dartlang-testcase:///patch_lib.dart */ _method2() → dynamic ; Extra constant evaluation status: -Evaluated: StaticGet @ org-dartlang-testcase:///origin_lib.dart:9:2 -> InstanceConstant(const _Patch{}) -Evaluated: StaticGet @ org-dartlang-testcase:///origin_lib.dart:12:1 -> InstanceConstant(const _Patch{}) -Extra constant evaluation: evaluated: 8, effectively constant: 2 +Evaluated: StaticGet @ org-dartlang-testcase:///origin_lib.dart:5:63 -> InstanceConstant(const _Patch{}) +Evaluated: StaticGet @ org-dartlang-testcase:///origin_lib.dart:7:5 -> InstanceConstant(const _Patch{}) +Evaluated: StaticGet @ org-dartlang-testcase:///origin_lib.dart:6:26 -> InstanceConstant(const _Patch{}) +Evaluated: StaticGet @ org-dartlang-testcase:///origin_lib.dart:7:51 -> InstanceConstant(const _Patch{}) +Extra constant evaluation: evaluated: 16, effectively constant: 4 diff --git a/pkg/front_end/testcases/extensions/patch/main.dart.strong.transformed.expect b/pkg/front_end/testcases/extensions/patch/main.dart.strong.transformed.expect index 7c4343c41d2..257799596e3 100644 --- a/pkg/front_end/testcases/extensions/patch/main.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/extensions/patch/main.dart.strong.transformed.expect @@ -1,12 +1,4 @@ library; -// -// Problems in library: -// -// pkg/front_end/testcases/extensions/patch/main.dart:9:5: Error: The method 'method2' isn't defined for the class 'int'. -// Try correcting the name to the name of an existing method, or defining a method named 'method2'. -// 0.method2(); -// ^^^^^^^ -// import self as self; import "dart:test" as test; @@ -14,21 +6,10 @@ import "dart:test"; static method test() → dynamic { test::IntExtension|method1(0); - invalid-expression "pkg/front_end/testcases/extensions/patch/main.dart:9:5: Error: The method 'method2' isn't defined for the class 'int'. -Try correcting the name to the name of an existing method, or defining a method named 'method2'. - 0.method2(); - ^^^^^^^" in 0{}.method2(); + test::IntExtension|method2(0); } library; -// -// Problems in library: -// -// pkg/front_end/testcases/extensions/patch/origin_lib.dart:11:5: Error: The method 'method2' isn't defined for the class 'int'. -// Try correcting the name to the name of an existing method, or defining a method named 'method2'. -// 0.method2(); -// ^^^^^^^ -// import self as test; import "dart:_internal" as _in; import "dart:core" as core; @@ -37,30 +18,47 @@ import "dart:_internal"; @#C1 extension IntExtension on core::int { - method method2 = test::IntExtension|method2; - method tearoff method2 = test::IntExtension|get#method2; method method1 = test::IntExtension|method1; method tearoff method1 = test::IntExtension|get#method1; + method method2 = test::IntExtension|method2; + method tearoff method2 = test::IntExtension|get#method2; +} +@#C1 +extension GenericExtension on T% { + method method3 = test::GenericExtension|method3; + method tearoff method3 = test::GenericExtension|get#method3; + method method4 = test::GenericExtension|method4; + method tearoff method4 = test::GenericExtension|get#method4; } @#C1 static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ IntExtension|method1(lowered final core::int #this) → core::int return 42; static extension-member method IntExtension|get#method1(lowered final core::int #this) → () → core::int return () → core::int => test::IntExtension|method1(#this); +@#C1 +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ GenericExtension|method3(lowered final test::GenericExtension|method3::T% #this) → core::int + return 42; +static extension-member method GenericExtension|get#method3(lowered final test::GenericExtension|get#method3::T% #this) → () → core::int + return () → core::int => test::GenericExtension|method3(#this); static method method1() → dynamic { test::IntExtension|method1(0); - invalid-expression "pkg/front_end/testcases/extensions/patch/origin_lib.dart:11:5: Error: The method 'method2' isn't defined for the class 'int'. -Try correcting the name to the name of an existing method, or defining a method named 'method2'. - 0.method2(); - ^^^^^^^" in 0{}.method2(); + test::IntExtension|method2(0); + test::GenericExtension|method3(0); + test::GenericExtension|method4(0); } static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ IntExtension|method2(lowered final core::int #this) → core::int return 43; static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ IntExtension|get#method2(lowered final core::int #this) → () → core::int return () → core::int => test::IntExtension|method2(#this); +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ GenericExtension|method4(lowered final test::GenericExtension|method4::T% #this) → core::int + return 43; +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ GenericExtension|get#method4(lowered final test::GenericExtension|get#method4::T% #this) → () → core::int + return () → core::int => test::GenericExtension|method4(#this); static method /* from org-dartlang-testcase:///patch_lib.dart */ _method2() → dynamic { test::IntExtension|method1(0); test::IntExtension|method2(0); + test::GenericExtension|method3(0); + test::GenericExtension|method4(0); } constants { diff --git a/pkg/front_end/testcases/extensions/patch/origin_lib.dart b/pkg/front_end/testcases/extensions/patch/origin_lib.dart index 1fa54b6f9d5..f6e5ce6960f 100644 --- a/pkg/front_end/testcases/extensions/patch/origin_lib.dart +++ b/pkg/front_end/testcases/extensions/patch/origin_lib.dart @@ -2,11 +2,46 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +// long long long long long long long long long long long long long long long +// long long long long long long long long long long long long long long long +// long long long long long long long long long long long long long long long +// long long long long long long long long long long long long long long long +// long long long long long long long long long long long long long long long +// long long long long long long long long long long long long long long long +// long long long long long long long long long long long long long long long +// long long long long long long long long long long long long long long long +// long long long long long long long long long long long long long long long +// long long long long long long long long long long long long long long long +// long long long long long long long long long long long long long long long +// long long long long long long long long long long long long long long long +// long long long long long long long long long long long long long long long +// long long long long long long long long long long long long long long long +// long long long long long long long long long long long long long long long +// long long long long long long long long long long long long long long long +// long long long long long long long long long long long long long long long +// long long long long long long long long long long long long long long long +// long long long long long long long long long long long long long long long +// long long long long long long long long long long long long long long long +// long long long long long long long long long long long long long long long +// long long long long long long long long long long long long long long long +// long long long long long long long long long long long long long long long +// long long long long long long long long long long long long long long long +// long long long long long long long long long long long long long long long +// long long long long long long long long long long long long long long long +// long comment to make offsets in `origin_lib.dart` out of range in +// `patch_lib.dart`. + extension IntExtension on int { external int method1(); } +extension GenericExtension on T { + external int method3(); +} + method1() { 0.method1(); 0.method2(); + 0.method3(); + 0.method4(); } diff --git a/pkg/front_end/testcases/extensions/patch/patch_lib.dart b/pkg/front_end/testcases/extensions/patch/patch_lib.dart index 98699a7f947..4a7bb9435f1 100644 --- a/pkg/front_end/testcases/extensions/patch/patch_lib.dart +++ b/pkg/front_end/testcases/extensions/patch/patch_lib.dart @@ -13,7 +13,17 @@ extension IntExtension on int { int method2() => 43; } +@patch +extension GenericExtension on T { + @patch + int method3() => 42; + + int method4() => 43; +} + _method2() { 0.method1(); 0.method2(); + 0.method3(); + 0.method4(); } diff --git a/pkg/front_end/testcases/general/constructor_patch/main.dart.strong.expect b/pkg/front_end/testcases/general/constructor_patch/main.dart.strong.expect index 082ffcc0fe6..35fd7d7c798 100644 --- a/pkg/front_end/testcases/general/constructor_patch/main.dart.strong.expect +++ b/pkg/front_end/testcases/general/constructor_patch/main.dart.strong.expect @@ -38,15 +38,6 @@ import "dart:_internal"; @/* from org-dartlang-testcase:///patch_lib.dart */ #C3 class Class extends core::Object /*hasConstConstructor*/ { final field core::bool defaultValue /* from org-dartlang-testcase:///patch_lib.dart */; - constructor /* from org-dartlang-testcase:///patch_lib.dart */ _privateInjected() → test::Class - : test::Class::defaultValue = false, super core::Object::•() - ; - constructor /* from org-dartlang-testcase:///patch_lib.dart */ redirect() → test::Class - : this test::Class::_private() - ; - constructor /* from org-dartlang-testcase:///patch_lib.dart */ redirectInjected() → test::Class - : this test::Class::_privateInjected() - ; @#C3 constructor /* from org-dartlang-testcase:///patch_lib.dart */ generative({core::bool defaultValue = #C1}) → test::Class : test::Class::defaultValue = defaultValue, super core::Object::•() @@ -59,11 +50,20 @@ class Class extends core::Object /*hasConstConstructor*/ { constructor /* from org-dartlang-testcase:///patch_lib.dart */ _private() → test::Class : test::Class::defaultValue = true, super core::Object::•() ; + constructor /* from org-dartlang-testcase:///patch_lib.dart */ _privateInjected() → test::Class + : test::Class::defaultValue = false, super core::Object::•() + ; + constructor /* from org-dartlang-testcase:///patch_lib.dart */ redirect() → test::Class + : this test::Class::_private() + ; + constructor /* from org-dartlang-testcase:///patch_lib.dart */ redirectInjected() → test::Class + : this test::Class::_privateInjected() + ; } @/* from org-dartlang-testcase:///patch_lib.dart */ #C3 class Class2 extends core::Object { - final field core::int injectedField /* from org-dartlang-testcase:///patch_lib.dart */; field core::int field; + final field core::int injectedField /* from org-dartlang-testcase:///patch_lib.dart */; @#C3 constructor /* from org-dartlang-testcase:///patch_lib.dart */ •(core::int field) → test::Class2 : test::Class2::field = field, test::Class2::injectedField = field, super core::Object::•() diff --git a/pkg/front_end/testcases/general/constructor_patch/main.dart.strong.modular.expect b/pkg/front_end/testcases/general/constructor_patch/main.dart.strong.modular.expect index 082ffcc0fe6..35fd7d7c798 100644 --- a/pkg/front_end/testcases/general/constructor_patch/main.dart.strong.modular.expect +++ b/pkg/front_end/testcases/general/constructor_patch/main.dart.strong.modular.expect @@ -38,15 +38,6 @@ import "dart:_internal"; @/* from org-dartlang-testcase:///patch_lib.dart */ #C3 class Class extends core::Object /*hasConstConstructor*/ { final field core::bool defaultValue /* from org-dartlang-testcase:///patch_lib.dart */; - constructor /* from org-dartlang-testcase:///patch_lib.dart */ _privateInjected() → test::Class - : test::Class::defaultValue = false, super core::Object::•() - ; - constructor /* from org-dartlang-testcase:///patch_lib.dart */ redirect() → test::Class - : this test::Class::_private() - ; - constructor /* from org-dartlang-testcase:///patch_lib.dart */ redirectInjected() → test::Class - : this test::Class::_privateInjected() - ; @#C3 constructor /* from org-dartlang-testcase:///patch_lib.dart */ generative({core::bool defaultValue = #C1}) → test::Class : test::Class::defaultValue = defaultValue, super core::Object::•() @@ -59,11 +50,20 @@ class Class extends core::Object /*hasConstConstructor*/ { constructor /* from org-dartlang-testcase:///patch_lib.dart */ _private() → test::Class : test::Class::defaultValue = true, super core::Object::•() ; + constructor /* from org-dartlang-testcase:///patch_lib.dart */ _privateInjected() → test::Class + : test::Class::defaultValue = false, super core::Object::•() + ; + constructor /* from org-dartlang-testcase:///patch_lib.dart */ redirect() → test::Class + : this test::Class::_private() + ; + constructor /* from org-dartlang-testcase:///patch_lib.dart */ redirectInjected() → test::Class + : this test::Class::_privateInjected() + ; } @/* from org-dartlang-testcase:///patch_lib.dart */ #C3 class Class2 extends core::Object { - final field core::int injectedField /* from org-dartlang-testcase:///patch_lib.dart */; field core::int field; + final field core::int injectedField /* from org-dartlang-testcase:///patch_lib.dart */; @#C3 constructor /* from org-dartlang-testcase:///patch_lib.dart */ •(core::int field) → test::Class2 : test::Class2::field = field, test::Class2::injectedField = field, super core::Object::•() diff --git a/pkg/front_end/testcases/general/constructor_patch/main.dart.strong.outline.expect b/pkg/front_end/testcases/general/constructor_patch/main.dart.strong.outline.expect index 1a2158e5aec..c444a46b423 100644 --- a/pkg/front_end/testcases/general/constructor_patch/main.dart.strong.outline.expect +++ b/pkg/front_end/testcases/general/constructor_patch/main.dart.strong.outline.expect @@ -18,12 +18,6 @@ import "dart:_internal"; @/* from org-dartlang-testcase:///patch_lib.dart */ _in::patch class Class extends core::Object /*hasConstConstructor*/ { final field core::bool defaultValue /* from org-dartlang-testcase:///patch_lib.dart */; - constructor /* from org-dartlang-testcase:///patch_lib.dart */ _privateInjected() → self2::Class - ; - constructor /* from org-dartlang-testcase:///patch_lib.dart */ redirect() → self2::Class - ; - constructor /* from org-dartlang-testcase:///patch_lib.dart */ redirectInjected() → self2::Class - ; @_in::patch external constructor generative({core::bool defaultValue = true}) → self2::Class; @_in::patch @@ -32,11 +26,17 @@ class Class extends core::Object /*hasConstConstructor*/ { ; @_in::patch external constructor _private() → self2::Class; + constructor /* from org-dartlang-testcase:///patch_lib.dart */ _privateInjected() → self2::Class + ; + constructor /* from org-dartlang-testcase:///patch_lib.dart */ redirect() → self2::Class + ; + constructor /* from org-dartlang-testcase:///patch_lib.dart */ redirectInjected() → self2::Class + ; } @/* from org-dartlang-testcase:///patch_lib.dart */ _in::patch class Class2 extends core::Object { - final field core::int injectedField /* from org-dartlang-testcase:///patch_lib.dart */; field core::int field; + final field core::int injectedField /* from org-dartlang-testcase:///patch_lib.dart */; @_in::patch external constructor •(core::int field) → self2::Class2; } diff --git a/pkg/front_end/testcases/general/constructor_patch/main.dart.strong.transformed.expect b/pkg/front_end/testcases/general/constructor_patch/main.dart.strong.transformed.expect index 082ffcc0fe6..35fd7d7c798 100644 --- a/pkg/front_end/testcases/general/constructor_patch/main.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/general/constructor_patch/main.dart.strong.transformed.expect @@ -38,15 +38,6 @@ import "dart:_internal"; @/* from org-dartlang-testcase:///patch_lib.dart */ #C3 class Class extends core::Object /*hasConstConstructor*/ { final field core::bool defaultValue /* from org-dartlang-testcase:///patch_lib.dart */; - constructor /* from org-dartlang-testcase:///patch_lib.dart */ _privateInjected() → test::Class - : test::Class::defaultValue = false, super core::Object::•() - ; - constructor /* from org-dartlang-testcase:///patch_lib.dart */ redirect() → test::Class - : this test::Class::_private() - ; - constructor /* from org-dartlang-testcase:///patch_lib.dart */ redirectInjected() → test::Class - : this test::Class::_privateInjected() - ; @#C3 constructor /* from org-dartlang-testcase:///patch_lib.dart */ generative({core::bool defaultValue = #C1}) → test::Class : test::Class::defaultValue = defaultValue, super core::Object::•() @@ -59,11 +50,20 @@ class Class extends core::Object /*hasConstConstructor*/ { constructor /* from org-dartlang-testcase:///patch_lib.dart */ _private() → test::Class : test::Class::defaultValue = true, super core::Object::•() ; + constructor /* from org-dartlang-testcase:///patch_lib.dart */ _privateInjected() → test::Class + : test::Class::defaultValue = false, super core::Object::•() + ; + constructor /* from org-dartlang-testcase:///patch_lib.dart */ redirect() → test::Class + : this test::Class::_private() + ; + constructor /* from org-dartlang-testcase:///patch_lib.dart */ redirectInjected() → test::Class + : this test::Class::_privateInjected() + ; } @/* from org-dartlang-testcase:///patch_lib.dart */ #C3 class Class2 extends core::Object { - final field core::int injectedField /* from org-dartlang-testcase:///patch_lib.dart */; field core::int field; + final field core::int injectedField /* from org-dartlang-testcase:///patch_lib.dart */; @#C3 constructor /* from org-dartlang-testcase:///patch_lib.dart */ •(core::int field) → test::Class2 : test::Class2::field = field, test::Class2::injectedField = field, super core::Object::•() diff --git a/pkg/front_end/testcases/general/inject_public/main.dart.strong.expect b/pkg/front_end/testcases/general/inject_public/main.dart.strong.expect index 46edd731622..4394326b312 100644 --- a/pkg/front_end/testcases/general/inject_public/main.dart.strong.expect +++ b/pkg/front_end/testcases/general/inject_public/main.dart.strong.expect @@ -19,33 +19,85 @@ library; // // pkg/front_end/testcases/general/inject_public/patch_lib.dart:8:7: Error: Can't inject public 'InjectedClass' into 'dart:test'. // Make 'InjectedClass' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). -// class InjectedClass {} +// class InjectedClass {} // Error // ^ // // pkg/front_end/testcases/general/inject_public/patch_lib.dart:10:1: Error: Can't inject public 'injectedMethod' into 'dart:test'. // Make 'injectedMethod' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). -// injectedMethod() {} +// injectedMethod() {} // Error // ^ // +// pkg/front_end/testcases/general/inject_public/patch_lib.dart:15:10: Error: Can't inject public 'staticInjectedMethod' into 'dart:test'. +// Make 'staticInjectedMethod' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). +// static staticInjectedMethod() {} // Error +// ^ +// +// pkg/front_end/testcases/general/inject_public/patch_lib.dart:21:10: Error: Can't inject public 'staticInjectedMethod' into 'dart:test'. +// Make 'staticInjectedMethod' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). +// static staticInjectedMethod() {} // Error +// ^ +// import self as test; -import "dart:core" as core; import "dart:_internal" as _in; +import "dart:core" as core; import "dart:_internal"; -class InjectedClass extends core::Object { // from org-dartlang-testcase:///patch_lib.dart - synthetic constructor •() → test::InjectedClass - : super core::Object::•() - ; -} @/* from org-dartlang-testcase:///patch_lib.dart */ #C1 class Class extends core::Object { synthetic constructor •() → test::Class : super core::Object::•() ; method /* from org-dartlang-testcase:///patch_lib.dart */ injectedMethod() → dynamic {} + static method /* from org-dartlang-testcase:///patch_lib.dart */ staticInjectedMethod() → dynamic {} +} +@/* from org-dartlang-testcase:///patch_lib.dart */ #C1 +class _PrivateClass extends core::Object { + synthetic constructor •() → test::_PrivateClass + : super core::Object::•() + ; + method /* from org-dartlang-testcase:///patch_lib.dart */ injectedMethod() → dynamic {} + static method /* from org-dartlang-testcase:///patch_lib.dart */ staticInjectedMethod() → dynamic {} +} +class InjectedClass extends core::Object { // from org-dartlang-testcase:///patch_lib.dart + synthetic constructor •() → test::InjectedClass + : super core::Object::•() + ; +} +class _PrivateInjectedClass extends core::Object { // from org-dartlang-testcase:///patch_lib.dart + synthetic constructor •() → test::_PrivateInjectedClass + : super core::Object::•() + ; + method publicMethod() → dynamic {} +} +@#C1 +extension Extension on core::int { + method injectedMethod = test::Extension|injectedMethod; + method tearoff injectedMethod = test::Extension|get#injectedMethod; + static method staticInjectedMethod = test::Extension|staticInjectedMethod; +} +@#C1 +extension _PrivateExtension on core::int { + method injectedMethod = test::_PrivateExtension|injectedMethod; + method tearoff injectedMethod = test::_PrivateExtension|get#injectedMethod; + static method staticInjectedMethod = test::_PrivateExtension|staticInjectedMethod; +} +extension _PrivateInjectedExtension on core::int { // from org-dartlang-testcase:///patch_lib.dart + method publicMethod = test::_PrivateInjectedExtension|publicMethod; + method tearoff publicMethod = test::_PrivateInjectedExtension|get#publicMethod; } static method /* from org-dartlang-testcase:///patch_lib.dart */ injectedMethod() → dynamic {} +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|injectedMethod(lowered final core::int #this) → dynamic {} +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|get#injectedMethod(lowered final core::int #this) → () → dynamic + return () → dynamic => test::Extension|injectedMethod(#this); +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|staticInjectedMethod() → dynamic {} +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ _PrivateInjectedExtension|publicMethod(lowered final core::int #this) → dynamic {} +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ _PrivateInjectedExtension|get#publicMethod(lowered final core::int #this) → () → dynamic + return () → dynamic => test::_PrivateInjectedExtension|publicMethod(#this); +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ _PrivateExtension|injectedMethod(lowered final core::int #this) → dynamic {} +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ _PrivateExtension|get#injectedMethod(lowered final core::int #this) → () → dynamic + return () → dynamic => test::_PrivateExtension|injectedMethod(#this); +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ _PrivateExtension|staticInjectedMethod() → dynamic {} constants { #C1 = _in::_Patch {} diff --git a/pkg/front_end/testcases/general/inject_public/main.dart.strong.modular.expect b/pkg/front_end/testcases/general/inject_public/main.dart.strong.modular.expect index 46edd731622..4394326b312 100644 --- a/pkg/front_end/testcases/general/inject_public/main.dart.strong.modular.expect +++ b/pkg/front_end/testcases/general/inject_public/main.dart.strong.modular.expect @@ -19,33 +19,85 @@ library; // // pkg/front_end/testcases/general/inject_public/patch_lib.dart:8:7: Error: Can't inject public 'InjectedClass' into 'dart:test'. // Make 'InjectedClass' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). -// class InjectedClass {} +// class InjectedClass {} // Error // ^ // // pkg/front_end/testcases/general/inject_public/patch_lib.dart:10:1: Error: Can't inject public 'injectedMethod' into 'dart:test'. // Make 'injectedMethod' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). -// injectedMethod() {} +// injectedMethod() {} // Error // ^ // +// pkg/front_end/testcases/general/inject_public/patch_lib.dart:15:10: Error: Can't inject public 'staticInjectedMethod' into 'dart:test'. +// Make 'staticInjectedMethod' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). +// static staticInjectedMethod() {} // Error +// ^ +// +// pkg/front_end/testcases/general/inject_public/patch_lib.dart:21:10: Error: Can't inject public 'staticInjectedMethod' into 'dart:test'. +// Make 'staticInjectedMethod' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). +// static staticInjectedMethod() {} // Error +// ^ +// import self as test; -import "dart:core" as core; import "dart:_internal" as _in; +import "dart:core" as core; import "dart:_internal"; -class InjectedClass extends core::Object { // from org-dartlang-testcase:///patch_lib.dart - synthetic constructor •() → test::InjectedClass - : super core::Object::•() - ; -} @/* from org-dartlang-testcase:///patch_lib.dart */ #C1 class Class extends core::Object { synthetic constructor •() → test::Class : super core::Object::•() ; method /* from org-dartlang-testcase:///patch_lib.dart */ injectedMethod() → dynamic {} + static method /* from org-dartlang-testcase:///patch_lib.dart */ staticInjectedMethod() → dynamic {} +} +@/* from org-dartlang-testcase:///patch_lib.dart */ #C1 +class _PrivateClass extends core::Object { + synthetic constructor •() → test::_PrivateClass + : super core::Object::•() + ; + method /* from org-dartlang-testcase:///patch_lib.dart */ injectedMethod() → dynamic {} + static method /* from org-dartlang-testcase:///patch_lib.dart */ staticInjectedMethod() → dynamic {} +} +class InjectedClass extends core::Object { // from org-dartlang-testcase:///patch_lib.dart + synthetic constructor •() → test::InjectedClass + : super core::Object::•() + ; +} +class _PrivateInjectedClass extends core::Object { // from org-dartlang-testcase:///patch_lib.dart + synthetic constructor •() → test::_PrivateInjectedClass + : super core::Object::•() + ; + method publicMethod() → dynamic {} +} +@#C1 +extension Extension on core::int { + method injectedMethod = test::Extension|injectedMethod; + method tearoff injectedMethod = test::Extension|get#injectedMethod; + static method staticInjectedMethod = test::Extension|staticInjectedMethod; +} +@#C1 +extension _PrivateExtension on core::int { + method injectedMethod = test::_PrivateExtension|injectedMethod; + method tearoff injectedMethod = test::_PrivateExtension|get#injectedMethod; + static method staticInjectedMethod = test::_PrivateExtension|staticInjectedMethod; +} +extension _PrivateInjectedExtension on core::int { // from org-dartlang-testcase:///patch_lib.dart + method publicMethod = test::_PrivateInjectedExtension|publicMethod; + method tearoff publicMethod = test::_PrivateInjectedExtension|get#publicMethod; } static method /* from org-dartlang-testcase:///patch_lib.dart */ injectedMethod() → dynamic {} +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|injectedMethod(lowered final core::int #this) → dynamic {} +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|get#injectedMethod(lowered final core::int #this) → () → dynamic + return () → dynamic => test::Extension|injectedMethod(#this); +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|staticInjectedMethod() → dynamic {} +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ _PrivateInjectedExtension|publicMethod(lowered final core::int #this) → dynamic {} +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ _PrivateInjectedExtension|get#publicMethod(lowered final core::int #this) → () → dynamic + return () → dynamic => test::_PrivateInjectedExtension|publicMethod(#this); +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ _PrivateExtension|injectedMethod(lowered final core::int #this) → dynamic {} +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ _PrivateExtension|get#injectedMethod(lowered final core::int #this) → () → dynamic + return () → dynamic => test::_PrivateExtension|injectedMethod(#this); +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ _PrivateExtension|staticInjectedMethod() → dynamic {} constants { #C1 = _in::_Patch {} diff --git a/pkg/front_end/testcases/general/inject_public/main.dart.strong.outline.expect b/pkg/front_end/testcases/general/inject_public/main.dart.strong.outline.expect index 8154ebcdc32..a34b2d05586 100644 --- a/pkg/front_end/testcases/general/inject_public/main.dart.strong.outline.expect +++ b/pkg/front_end/testcases/general/inject_public/main.dart.strong.outline.expect @@ -14,35 +14,97 @@ library; // // pkg/front_end/testcases/general/inject_public/patch_lib.dart:8:7: Error: Can't inject public 'InjectedClass' into 'dart:test'. // Make 'InjectedClass' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). -// class InjectedClass {} +// class InjectedClass {} // Error // ^ // // pkg/front_end/testcases/general/inject_public/patch_lib.dart:10:1: Error: Can't inject public 'injectedMethod' into 'dart:test'. // Make 'injectedMethod' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). -// injectedMethod() {} +// injectedMethod() {} // Error // ^ // +// pkg/front_end/testcases/general/inject_public/patch_lib.dart:15:10: Error: Can't inject public 'staticInjectedMethod' into 'dart:test'. +// Make 'staticInjectedMethod' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). +// static staticInjectedMethod() {} // Error +// ^ +// +// pkg/front_end/testcases/general/inject_public/patch_lib.dart:21:10: Error: Can't inject public 'staticInjectedMethod' into 'dart:test'. +// Make 'staticInjectedMethod' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). +// static staticInjectedMethod() {} // Error +// ^ +// import self as self2; -import "dart:core" as core; import "dart:_internal" as _in; +import "dart:core" as core; import "dart:_internal"; -class InjectedClass extends core::Object { // from org-dartlang-testcase:///patch_lib.dart - synthetic constructor •() → self2::InjectedClass - ; -} @/* from org-dartlang-testcase:///patch_lib.dart */ _in::patch class Class extends core::Object { synthetic constructor •() → self2::Class ; method /* from org-dartlang-testcase:///patch_lib.dart */ injectedMethod() → dynamic ; + static method /* from org-dartlang-testcase:///patch_lib.dart */ staticInjectedMethod() → dynamic + ; +} +@/* from org-dartlang-testcase:///patch_lib.dart */ _in::patch +class _PrivateClass extends core::Object { + synthetic constructor •() → self2::_PrivateClass + ; + method /* from org-dartlang-testcase:///patch_lib.dart */ injectedMethod() → dynamic + ; + static method /* from org-dartlang-testcase:///patch_lib.dart */ staticInjectedMethod() → dynamic + ; +} +class InjectedClass extends core::Object { // from org-dartlang-testcase:///patch_lib.dart + synthetic constructor •() → self2::InjectedClass + ; +} +class _PrivateInjectedClass extends core::Object { // from org-dartlang-testcase:///patch_lib.dart + synthetic constructor •() → self2::_PrivateInjectedClass + ; + method publicMethod() → dynamic + ; +} +@_in::patch +extension Extension on core::int { + method injectedMethod = self2::Extension|injectedMethod; + method tearoff injectedMethod = self2::Extension|get#injectedMethod; + static method staticInjectedMethod = self2::Extension|staticInjectedMethod; +} +@_in::patch +extension _PrivateExtension on core::int { + method injectedMethod = self2::_PrivateExtension|injectedMethod; + method tearoff injectedMethod = self2::_PrivateExtension|get#injectedMethod; + static method staticInjectedMethod = self2::_PrivateExtension|staticInjectedMethod; +} +extension _PrivateInjectedExtension on core::int { // from org-dartlang-testcase:///patch_lib.dart + method publicMethod = self2::_PrivateInjectedExtension|publicMethod; + method tearoff publicMethod = self2::_PrivateInjectedExtension|get#publicMethod; } static method /* from org-dartlang-testcase:///patch_lib.dart */ injectedMethod() → dynamic ; +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|injectedMethod(lowered final core::int #this) → dynamic + ; +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|get#injectedMethod(lowered final core::int #this) → () → dynamic + return () → dynamic => self2::Extension|injectedMethod(#this); +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|staticInjectedMethod() → dynamic + ; +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ _PrivateInjectedExtension|publicMethod(lowered final core::int #this) → dynamic + ; +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ _PrivateInjectedExtension|get#publicMethod(lowered final core::int #this) → () → dynamic + return () → dynamic => self2::_PrivateInjectedExtension|publicMethod(#this); +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ _PrivateExtension|injectedMethod(lowered final core::int #this) → dynamic + ; +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ _PrivateExtension|get#injectedMethod(lowered final core::int #this) → () → dynamic + return () → dynamic => self2::_PrivateExtension|injectedMethod(#this); +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ _PrivateExtension|staticInjectedMethod() → dynamic + ; Extra constant evaluation status: Evaluated: FileUriExpression @ org-dartlang-testcase:///patch_lib.dart:12:1 -> InstanceConstant(const _Patch{}) -Extra constant evaluation: evaluated: 1, effectively constant: 1 +Evaluated: FileUriExpression @ org-dartlang-testcase:///patch_lib.dart:32:1 -> InstanceConstant(const _Patch{}) +Evaluated: StaticGet @ (unknown position in org-dartlang-testcase:///origin_lib.dart) -> InstanceConstant(const _Patch{}) +Evaluated: StaticGet @ (unknown position in org-dartlang-testcase:///origin_lib.dart) -> InstanceConstant(const _Patch{}) +Extra constant evaluation: evaluated: 13, effectively constant: 4 diff --git a/pkg/front_end/testcases/general/inject_public/main.dart.strong.transformed.expect b/pkg/front_end/testcases/general/inject_public/main.dart.strong.transformed.expect index 46edd731622..4394326b312 100644 --- a/pkg/front_end/testcases/general/inject_public/main.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/general/inject_public/main.dart.strong.transformed.expect @@ -19,33 +19,85 @@ library; // // pkg/front_end/testcases/general/inject_public/patch_lib.dart:8:7: Error: Can't inject public 'InjectedClass' into 'dart:test'. // Make 'InjectedClass' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). -// class InjectedClass {} +// class InjectedClass {} // Error // ^ // // pkg/front_end/testcases/general/inject_public/patch_lib.dart:10:1: Error: Can't inject public 'injectedMethod' into 'dart:test'. // Make 'injectedMethod' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). -// injectedMethod() {} +// injectedMethod() {} // Error // ^ // +// pkg/front_end/testcases/general/inject_public/patch_lib.dart:15:10: Error: Can't inject public 'staticInjectedMethod' into 'dart:test'. +// Make 'staticInjectedMethod' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). +// static staticInjectedMethod() {} // Error +// ^ +// +// pkg/front_end/testcases/general/inject_public/patch_lib.dart:21:10: Error: Can't inject public 'staticInjectedMethod' into 'dart:test'. +// Make 'staticInjectedMethod' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). +// static staticInjectedMethod() {} // Error +// ^ +// import self as test; -import "dart:core" as core; import "dart:_internal" as _in; +import "dart:core" as core; import "dart:_internal"; -class InjectedClass extends core::Object { // from org-dartlang-testcase:///patch_lib.dart - synthetic constructor •() → test::InjectedClass - : super core::Object::•() - ; -} @/* from org-dartlang-testcase:///patch_lib.dart */ #C1 class Class extends core::Object { synthetic constructor •() → test::Class : super core::Object::•() ; method /* from org-dartlang-testcase:///patch_lib.dart */ injectedMethod() → dynamic {} + static method /* from org-dartlang-testcase:///patch_lib.dart */ staticInjectedMethod() → dynamic {} +} +@/* from org-dartlang-testcase:///patch_lib.dart */ #C1 +class _PrivateClass extends core::Object { + synthetic constructor •() → test::_PrivateClass + : super core::Object::•() + ; + method /* from org-dartlang-testcase:///patch_lib.dart */ injectedMethod() → dynamic {} + static method /* from org-dartlang-testcase:///patch_lib.dart */ staticInjectedMethod() → dynamic {} +} +class InjectedClass extends core::Object { // from org-dartlang-testcase:///patch_lib.dart + synthetic constructor •() → test::InjectedClass + : super core::Object::•() + ; +} +class _PrivateInjectedClass extends core::Object { // from org-dartlang-testcase:///patch_lib.dart + synthetic constructor •() → test::_PrivateInjectedClass + : super core::Object::•() + ; + method publicMethod() → dynamic {} +} +@#C1 +extension Extension on core::int { + method injectedMethod = test::Extension|injectedMethod; + method tearoff injectedMethod = test::Extension|get#injectedMethod; + static method staticInjectedMethod = test::Extension|staticInjectedMethod; +} +@#C1 +extension _PrivateExtension on core::int { + method injectedMethod = test::_PrivateExtension|injectedMethod; + method tearoff injectedMethod = test::_PrivateExtension|get#injectedMethod; + static method staticInjectedMethod = test::_PrivateExtension|staticInjectedMethod; +} +extension _PrivateInjectedExtension on core::int { // from org-dartlang-testcase:///patch_lib.dart + method publicMethod = test::_PrivateInjectedExtension|publicMethod; + method tearoff publicMethod = test::_PrivateInjectedExtension|get#publicMethod; } static method /* from org-dartlang-testcase:///patch_lib.dart */ injectedMethod() → dynamic {} +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|injectedMethod(lowered final core::int #this) → dynamic {} +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|get#injectedMethod(lowered final core::int #this) → () → dynamic + return () → dynamic => test::Extension|injectedMethod(#this); +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|staticInjectedMethod() → dynamic {} +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ _PrivateInjectedExtension|publicMethod(lowered final core::int #this) → dynamic {} +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ _PrivateInjectedExtension|get#publicMethod(lowered final core::int #this) → () → dynamic + return () → dynamic => test::_PrivateInjectedExtension|publicMethod(#this); +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ _PrivateExtension|injectedMethod(lowered final core::int #this) → dynamic {} +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ _PrivateExtension|get#injectedMethod(lowered final core::int #this) → () → dynamic + return () → dynamic => test::_PrivateExtension|injectedMethod(#this); +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ _PrivateExtension|staticInjectedMethod() → dynamic {} constants { #C1 = _in::_Patch {} diff --git a/pkg/front_end/testcases/general/inject_public/origin_lib.dart b/pkg/front_end/testcases/general/inject_public/origin_lib.dart index 8ffa6e4caa3..6139ca2898e 100644 --- a/pkg/front_end/testcases/general/inject_public/origin_lib.dart +++ b/pkg/front_end/testcases/general/inject_public/origin_lib.dart @@ -3,3 +3,9 @@ // BSD-style license that can be found in the LICENSE file. class Class {} + +extension Extension on int {} + +class _PrivateClass {} + +extension _PrivateExtension on int {} diff --git a/pkg/front_end/testcases/general/inject_public/patch_lib.dart b/pkg/front_end/testcases/general/inject_public/patch_lib.dart index 4f38587215d..de55ed7376e 100644 --- a/pkg/front_end/testcases/general/inject_public/patch_lib.dart +++ b/pkg/front_end/testcases/general/inject_public/patch_lib.dart @@ -5,11 +5,38 @@ // ignore: import_internal_library import 'dart:_internal'; -class InjectedClass {} +class InjectedClass {} // Error -injectedMethod() {} +injectedMethod() {} // Error @patch class Class { - injectedMethod() {} + injectedMethod() {} // Error + static staticInjectedMethod() {} // Error +} + +@patch +extension Extension on int { + injectedMethod() {} // Error + static staticInjectedMethod() {} // Error +} + +class _PrivateInjectedClass /* Ok */ { + publicMethod() {} // Ok +} + +extension _PrivateInjectedExtension on int /* Ok */ { + publicMethod() {} // Ok +} + +@patch +class _PrivateClass { + injectedMethod() {} // Error + static staticInjectedMethod() {} // Ok +} + +@patch +extension _PrivateExtension on int { + injectedMethod() {} // Error + static staticInjectedMethod() {} // Ok } diff --git a/pkg/front_end/testcases/general/issue45101/main.dart.strong.expect b/pkg/front_end/testcases/general/issue45101/main.dart.strong.expect index 375479e4d71..55463c0a133 100644 --- a/pkg/front_end/testcases/general/issue45101/main.dart.strong.expect +++ b/pkg/front_end/testcases/general/issue45101/main.dart.strong.expect @@ -7,17 +7,11 @@ static method main() → dynamic {} library; import self as self2; -import "dart:core" as core; import "dart:_internal" as _in; +import "dart:core" as core; import "dart:_internal"; -class _ArraySize extends core::Object implements self2::Array /*hasConstConstructor*/ { // from org-dartlang-testcase:///patch_lib.dart - final field core::int foo; - const constructor •(core::int foo) → self2::_ArraySize - : self2::_ArraySize::foo = foo, super core::Object::•() - ; -} @/* from org-dartlang-testcase:///patch_lib.dart */ #C1 @/* from org-dartlang-testcase:///patch_lib.dart */ #C4 class Array extends core::Object { @@ -25,6 +19,12 @@ class Array extends core::Object { static factory /* from org-dartlang-testcase:///patch_lib.dart */ •(core::int foo) → self2::Array /* redirection-target: self2::_ArraySize::•*/ return new self2::_ArraySize::•(foo); } +class _ArraySize extends core::Object implements self2::Array /*hasConstConstructor*/ { // from org-dartlang-testcase:///patch_lib.dart + final field core::int foo; + const constructor •(core::int foo) → self2::_ArraySize + : self2::_ArraySize::foo = foo, super core::Object::•() + ; +} constants { #C1 = _in::_Patch {} diff --git a/pkg/front_end/testcases/general/issue45101/main.dart.strong.modular.expect b/pkg/front_end/testcases/general/issue45101/main.dart.strong.modular.expect index 375479e4d71..55463c0a133 100644 --- a/pkg/front_end/testcases/general/issue45101/main.dart.strong.modular.expect +++ b/pkg/front_end/testcases/general/issue45101/main.dart.strong.modular.expect @@ -7,17 +7,11 @@ static method main() → dynamic {} library; import self as self2; -import "dart:core" as core; import "dart:_internal" as _in; +import "dart:core" as core; import "dart:_internal"; -class _ArraySize extends core::Object implements self2::Array /*hasConstConstructor*/ { // from org-dartlang-testcase:///patch_lib.dart - final field core::int foo; - const constructor •(core::int foo) → self2::_ArraySize - : self2::_ArraySize::foo = foo, super core::Object::•() - ; -} @/* from org-dartlang-testcase:///patch_lib.dart */ #C1 @/* from org-dartlang-testcase:///patch_lib.dart */ #C4 class Array extends core::Object { @@ -25,6 +19,12 @@ class Array extends core::Object { static factory /* from org-dartlang-testcase:///patch_lib.dart */ •(core::int foo) → self2::Array /* redirection-target: self2::_ArraySize::•*/ return new self2::_ArraySize::•(foo); } +class _ArraySize extends core::Object implements self2::Array /*hasConstConstructor*/ { // from org-dartlang-testcase:///patch_lib.dart + final field core::int foo; + const constructor •(core::int foo) → self2::_ArraySize + : self2::_ArraySize::foo = foo, super core::Object::•() + ; +} constants { #C1 = _in::_Patch {} diff --git a/pkg/front_end/testcases/general/issue45101/main.dart.strong.outline.expect b/pkg/front_end/testcases/general/issue45101/main.dart.strong.outline.expect index 8c0e628c74a..fc7f661a195 100644 --- a/pkg/front_end/testcases/general/issue45101/main.dart.strong.outline.expect +++ b/pkg/front_end/testcases/general/issue45101/main.dart.strong.outline.expect @@ -8,17 +8,11 @@ static method main() → dynamic library; import self as self2; -import "dart:core" as core; import "dart:_internal" as _in; +import "dart:core" as core; import "dart:_internal"; -class _ArraySize extends core::Object implements self2::Array /*hasConstConstructor*/ { // from org-dartlang-testcase:///patch_lib.dart - final field core::int foo; - const constructor •(core::int foo) → self2::_ArraySize - : self2::_ArraySize::foo = foo, super core::Object::•() - ; -} @/* from org-dartlang-testcase:///patch_lib.dart */ _in::patch @/* from org-dartlang-testcase:///patch_lib.dart */ const core::pragma::_("vm:entry-point") class Array extends core::Object { @@ -26,6 +20,12 @@ class Array extends core::Object { static factory /* from org-dartlang-testcase:///patch_lib.dart */ •(core::int foo) → self2::Array /* redirection-target: self2::_ArraySize::•*/ return new self2::_ArraySize::•(foo); } +class _ArraySize extends core::Object implements self2::Array /*hasConstConstructor*/ { // from org-dartlang-testcase:///patch_lib.dart + final field core::int foo; + const constructor •(core::int foo) → self2::_ArraySize + : self2::_ArraySize::foo = foo, super core::Object::•() + ; +} Extra constant evaluation status: diff --git a/pkg/front_end/testcases/general/issue45101/main.dart.strong.transformed.expect b/pkg/front_end/testcases/general/issue45101/main.dart.strong.transformed.expect index 375479e4d71..55463c0a133 100644 --- a/pkg/front_end/testcases/general/issue45101/main.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/general/issue45101/main.dart.strong.transformed.expect @@ -7,17 +7,11 @@ static method main() → dynamic {} library; import self as self2; -import "dart:core" as core; import "dart:_internal" as _in; +import "dart:core" as core; import "dart:_internal"; -class _ArraySize extends core::Object implements self2::Array /*hasConstConstructor*/ { // from org-dartlang-testcase:///patch_lib.dart - final field core::int foo; - const constructor •(core::int foo) → self2::_ArraySize - : self2::_ArraySize::foo = foo, super core::Object::•() - ; -} @/* from org-dartlang-testcase:///patch_lib.dart */ #C1 @/* from org-dartlang-testcase:///patch_lib.dart */ #C4 class Array extends core::Object { @@ -25,6 +19,12 @@ class Array extends core::Object { static factory /* from org-dartlang-testcase:///patch_lib.dart */ •(core::int foo) → self2::Array /* redirection-target: self2::_ArraySize::•*/ return new self2::_ArraySize::•(foo); } +class _ArraySize extends core::Object implements self2::Array /*hasConstConstructor*/ { // from org-dartlang-testcase:///patch_lib.dart + final field core::int foo; + const constructor •(core::int foo) → self2::_ArraySize + : self2::_ArraySize::foo = foo, super core::Object::•() + ; +} constants { #C1 = _in::_Patch {} diff --git a/pkg/front_end/testcases/general/mixin_from_patch/main.dart.strong.expect b/pkg/front_end/testcases/general/mixin_from_patch/main.dart.strong.expect index b9b1a3137f4..3b2643b7cb9 100644 --- a/pkg/front_end/testcases/general/mixin_from_patch/main.dart.strong.expect +++ b/pkg/front_end/testcases/general/mixin_from_patch/main.dart.strong.expect @@ -20,9 +20,6 @@ import "dart:_internal"; @/* from org-dartlang-testcase:///patch_lib.dart */ #C1 class Class extends core::Object { - constructor /* from org-dartlang-testcase:///patch_lib.dart */ _internal({core::bool value = #C2}) → test::Class - : super core::Object::•() - ; @#C1 constructor /* from org-dartlang-testcase:///patch_lib.dart */ patched() → test::Class : this test::Class::_internal() @@ -30,14 +27,14 @@ class Class extends core::Object { constructor unpatched() → test::Class : super core::Object::•() ; + constructor /* from org-dartlang-testcase:///patch_lib.dart */ _internal({core::bool value = #C2}) → test::Class + : super core::Object::•() + ; } abstract class Mixin extends core::Object /*isMixinDeclaration*/ { } @/* from org-dartlang-testcase:///patch_lib.dart */ #C1 class SubClass extends test::_SubClass&Class&Mixin { - constructor /* from org-dartlang-testcase:///patch_lib.dart */ _internal() → test::SubClass - : super test::_SubClass&Class&Mixin::_internal(value: true) - ; @#C1 constructor /* from org-dartlang-testcase:///patch_lib.dart */ patched() → test::SubClass : this test::SubClass::_internal() @@ -45,6 +42,9 @@ class SubClass extends test::_SubClass&Class&Mixin { constructor unpatched() → test::SubClass : super test::_SubClass&Class&Mixin::unpatched() ; + constructor /* from org-dartlang-testcase:///patch_lib.dart */ _internal() → test::SubClass + : super test::_SubClass&Class&Mixin::_internal(value: true) + ; } abstract class _SubClass&Class&Mixin = test::Class with test::Mixin /*isAnonymousMixin*/ { synthetic constructor patched() → test::_SubClass&Class&Mixin diff --git a/pkg/front_end/testcases/general/mixin_from_patch/main.dart.strong.modular.expect b/pkg/front_end/testcases/general/mixin_from_patch/main.dart.strong.modular.expect index b9b1a3137f4..3b2643b7cb9 100644 --- a/pkg/front_end/testcases/general/mixin_from_patch/main.dart.strong.modular.expect +++ b/pkg/front_end/testcases/general/mixin_from_patch/main.dart.strong.modular.expect @@ -20,9 +20,6 @@ import "dart:_internal"; @/* from org-dartlang-testcase:///patch_lib.dart */ #C1 class Class extends core::Object { - constructor /* from org-dartlang-testcase:///patch_lib.dart */ _internal({core::bool value = #C2}) → test::Class - : super core::Object::•() - ; @#C1 constructor /* from org-dartlang-testcase:///patch_lib.dart */ patched() → test::Class : this test::Class::_internal() @@ -30,14 +27,14 @@ class Class extends core::Object { constructor unpatched() → test::Class : super core::Object::•() ; + constructor /* from org-dartlang-testcase:///patch_lib.dart */ _internal({core::bool value = #C2}) → test::Class + : super core::Object::•() + ; } abstract class Mixin extends core::Object /*isMixinDeclaration*/ { } @/* from org-dartlang-testcase:///patch_lib.dart */ #C1 class SubClass extends test::_SubClass&Class&Mixin { - constructor /* from org-dartlang-testcase:///patch_lib.dart */ _internal() → test::SubClass - : super test::_SubClass&Class&Mixin::_internal(value: true) - ; @#C1 constructor /* from org-dartlang-testcase:///patch_lib.dart */ patched() → test::SubClass : this test::SubClass::_internal() @@ -45,6 +42,9 @@ class SubClass extends test::_SubClass&Class&Mixin { constructor unpatched() → test::SubClass : super test::_SubClass&Class&Mixin::unpatched() ; + constructor /* from org-dartlang-testcase:///patch_lib.dart */ _internal() → test::SubClass + : super test::_SubClass&Class&Mixin::_internal(value: true) + ; } abstract class _SubClass&Class&Mixin = test::Class with test::Mixin /*isAnonymousMixin*/ { synthetic constructor patched() → test::_SubClass&Class&Mixin diff --git a/pkg/front_end/testcases/general/mixin_from_patch/main.dart.strong.outline.expect b/pkg/front_end/testcases/general/mixin_from_patch/main.dart.strong.outline.expect index dddb724ae02..6d3f961ede7 100644 --- a/pkg/front_end/testcases/general/mixin_from_patch/main.dart.strong.outline.expect +++ b/pkg/front_end/testcases/general/mixin_from_patch/main.dart.strong.outline.expect @@ -15,23 +15,23 @@ import "dart:_internal"; @/* from org-dartlang-testcase:///patch_lib.dart */ _in::patch class Class extends core::Object { - constructor /* from org-dartlang-testcase:///patch_lib.dart */ _internal({core::bool value = false}) → self2::Class - ; @_in::patch external constructor patched() → self2::Class; constructor unpatched() → self2::Class ; + constructor /* from org-dartlang-testcase:///patch_lib.dart */ _internal({core::bool value = false}) → self2::Class + ; } abstract class Mixin extends core::Object /*isMixinDeclaration*/ { } @/* from org-dartlang-testcase:///patch_lib.dart */ _in::patch class SubClass extends self2::_SubClass&Class&Mixin { - constructor /* from org-dartlang-testcase:///patch_lib.dart */ _internal() → self2::SubClass - ; @_in::patch external constructor patched() → self2::SubClass; constructor unpatched() → self2::SubClass ; + constructor /* from org-dartlang-testcase:///patch_lib.dart */ _internal() → self2::SubClass + ; } abstract class _SubClass&Class&Mixin = self2::Class with self2::Mixin /*isAnonymousMixin*/ { synthetic constructor patched() → self2::_SubClass&Class&Mixin diff --git a/pkg/front_end/testcases/general/mixin_from_patch/main.dart.strong.transformed.expect b/pkg/front_end/testcases/general/mixin_from_patch/main.dart.strong.transformed.expect index 8134a1f583d..44649ad1167 100644 --- a/pkg/front_end/testcases/general/mixin_from_patch/main.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/general/mixin_from_patch/main.dart.strong.transformed.expect @@ -20,9 +20,6 @@ import "dart:_internal"; @/* from org-dartlang-testcase:///patch_lib.dart */ #C1 class Class extends core::Object { - constructor /* from org-dartlang-testcase:///patch_lib.dart */ _internal({core::bool value = #C2}) → test::Class - : super core::Object::•() - ; @#C1 constructor /* from org-dartlang-testcase:///patch_lib.dart */ patched() → test::Class : this test::Class::_internal() @@ -30,14 +27,14 @@ class Class extends core::Object { constructor unpatched() → test::Class : super core::Object::•() ; + constructor /* from org-dartlang-testcase:///patch_lib.dart */ _internal({core::bool value = #C2}) → test::Class + : super core::Object::•() + ; } abstract class Mixin extends core::Object /*isMixinDeclaration*/ { } @/* from org-dartlang-testcase:///patch_lib.dart */ #C1 class SubClass extends test::_SubClass&Class&Mixin { - constructor /* from org-dartlang-testcase:///patch_lib.dart */ _internal() → test::SubClass - : super test::_SubClass&Class&Mixin::_internal(value: true) - ; @#C1 constructor /* from org-dartlang-testcase:///patch_lib.dart */ patched() → test::SubClass : this test::SubClass::_internal() @@ -45,6 +42,9 @@ class SubClass extends test::_SubClass&Class&Mixin { constructor unpatched() → test::SubClass : super test::_SubClass&Class&Mixin::unpatched() ; + constructor /* from org-dartlang-testcase:///patch_lib.dart */ _internal() → test::SubClass + : super test::_SubClass&Class&Mixin::_internal(value: true) + ; } abstract class _SubClass&Class&Mixin extends test::Class implements test::Mixin /*isAnonymousMixin,isEliminatedMixin*/ { synthetic constructor patched() → test::_SubClass&Class&Mixin diff --git a/pkg/front_end/testcases/general/patch_annotations/main.dart.strong.expect b/pkg/front_end/testcases/general/patch_annotations/main.dart.strong.expect index 87f593437d7..c4c9ff3bede 100644 --- a/pkg/front_end/testcases/general/patch_annotations/main.dart.strong.expect +++ b/pkg/front_end/testcases/general/patch_annotations/main.dart.strong.expect @@ -5,8 +5,7 @@ import "dart:test"; static method main() → dynamic {} -@/* from org-dartlang-testcase:///patch_lib.dart */ #C3 -@#C5 +@#C3 library; import self as self2; import "dart:core" as core; @@ -14,45 +13,43 @@ import "dart:_internal" as _in; import "dart:_internal"; +@#C5 @/* from org-dartlang-testcase:///patch_lib.dart */ #C6 @/* from org-dartlang-testcase:///patch_lib.dart */ #C8 -@#C10 -class Class<@#C12 @#C14 T extends core::Object? = dynamic> extends core::Object { +class Class<@#C10 @#C12 T extends core::Object? = dynamic> extends core::Object { + @/* from org-dartlang-testcase:///origin_lib.dart */ #C14 @#C6 @#C16 - @/* from org-dartlang-testcase:///origin_lib.dart */ #C18 external constructor /* from org-dartlang-testcase:///patch_lib.dart */ •() → self2::Class; + @/* from org-dartlang-testcase:///origin_lib.dart */ #C18 @#C6 @#C20 - @/* from org-dartlang-testcase:///origin_lib.dart */ #C22 - external method /* from org-dartlang-testcase:///patch_lib.dart */ method<@#C24 S extends core::Object? = dynamic>() → void; + external method /* from org-dartlang-testcase:///patch_lib.dart */ method<@#C22 S extends core::Object? = dynamic>() → void; } constants { - #C1 = "patch-library" + #C1 = "origin-library" #C2 = null #C3 = core::pragma {name:#C1, options:#C2} - #C4 = "origin-library" + #C4 = "origin-class" #C5 = core::pragma {name:#C4, options:#C2} #C6 = _in::_Patch {} #C7 = "patch-class" #C8 = core::pragma {name:#C7, options:#C2} - #C9 = "origin-class" + #C9 = "origin-class-type-variable" #C10 = core::pragma {name:#C9, options:#C2} #C11 = "patch-class-type-variable" #C12 = core::pragma {name:#C11, options:#C2} - #C13 = "origin-class-type-variable" + #C13 = "origin-constructor" #C14 = core::pragma {name:#C13, options:#C2} #C15 = "patch-constructor" #C16 = core::pragma {name:#C15, options:#C2} - #C17 = "origin-constructor" + #C17 = "origin-procedure" #C18 = core::pragma {name:#C17, options:#C2} #C19 = "patch-procedure" #C20 = core::pragma {name:#C19, options:#C2} - #C21 = "origin-procedure" + #C21 = "patch-method-type-variable" #C22 = core::pragma {name:#C21, options:#C2} - #C23 = "patch-method-type-variable" - #C24 = core::pragma {name:#C23, options:#C2} } diff --git a/pkg/front_end/testcases/general/patch_annotations/main.dart.strong.modular.expect b/pkg/front_end/testcases/general/patch_annotations/main.dart.strong.modular.expect index 87f593437d7..c4c9ff3bede 100644 --- a/pkg/front_end/testcases/general/patch_annotations/main.dart.strong.modular.expect +++ b/pkg/front_end/testcases/general/patch_annotations/main.dart.strong.modular.expect @@ -5,8 +5,7 @@ import "dart:test"; static method main() → dynamic {} -@/* from org-dartlang-testcase:///patch_lib.dart */ #C3 -@#C5 +@#C3 library; import self as self2; import "dart:core" as core; @@ -14,45 +13,43 @@ import "dart:_internal" as _in; import "dart:_internal"; +@#C5 @/* from org-dartlang-testcase:///patch_lib.dart */ #C6 @/* from org-dartlang-testcase:///patch_lib.dart */ #C8 -@#C10 -class Class<@#C12 @#C14 T extends core::Object? = dynamic> extends core::Object { +class Class<@#C10 @#C12 T extends core::Object? = dynamic> extends core::Object { + @/* from org-dartlang-testcase:///origin_lib.dart */ #C14 @#C6 @#C16 - @/* from org-dartlang-testcase:///origin_lib.dart */ #C18 external constructor /* from org-dartlang-testcase:///patch_lib.dart */ •() → self2::Class; + @/* from org-dartlang-testcase:///origin_lib.dart */ #C18 @#C6 @#C20 - @/* from org-dartlang-testcase:///origin_lib.dart */ #C22 - external method /* from org-dartlang-testcase:///patch_lib.dart */ method<@#C24 S extends core::Object? = dynamic>() → void; + external method /* from org-dartlang-testcase:///patch_lib.dart */ method<@#C22 S extends core::Object? = dynamic>() → void; } constants { - #C1 = "patch-library" + #C1 = "origin-library" #C2 = null #C3 = core::pragma {name:#C1, options:#C2} - #C4 = "origin-library" + #C4 = "origin-class" #C5 = core::pragma {name:#C4, options:#C2} #C6 = _in::_Patch {} #C7 = "patch-class" #C8 = core::pragma {name:#C7, options:#C2} - #C9 = "origin-class" + #C9 = "origin-class-type-variable" #C10 = core::pragma {name:#C9, options:#C2} #C11 = "patch-class-type-variable" #C12 = core::pragma {name:#C11, options:#C2} - #C13 = "origin-class-type-variable" + #C13 = "origin-constructor" #C14 = core::pragma {name:#C13, options:#C2} #C15 = "patch-constructor" #C16 = core::pragma {name:#C15, options:#C2} - #C17 = "origin-constructor" + #C17 = "origin-procedure" #C18 = core::pragma {name:#C17, options:#C2} #C19 = "patch-procedure" #C20 = core::pragma {name:#C19, options:#C2} - #C21 = "origin-procedure" + #C21 = "patch-method-type-variable" #C22 = core::pragma {name:#C21, options:#C2} - #C23 = "patch-method-type-variable" - #C24 = core::pragma {name:#C23, options:#C2} } diff --git a/pkg/front_end/testcases/general/patch_annotations/main.dart.strong.outline.expect b/pkg/front_end/testcases/general/patch_annotations/main.dart.strong.outline.expect index f38c3d35784..9dcff0a5579 100644 --- a/pkg/front_end/testcases/general/patch_annotations/main.dart.strong.outline.expect +++ b/pkg/front_end/testcases/general/patch_annotations/main.dart.strong.outline.expect @@ -6,7 +6,6 @@ import "dart:test"; static method main() → dynamic ; -@/* from org-dartlang-testcase:///patch_lib.dart */ const dart.core::pragma::_("patch-library") @dart.core::pragma::_("origin-library") library; import self as self2; @@ -15,34 +14,33 @@ import "dart:_internal" as _in; import "dart:_internal"; +@core::pragma::_("origin-class") @/* from org-dartlang-testcase:///patch_lib.dart */ _in::patch @/* from org-dartlang-testcase:///patch_lib.dart */ const core::pragma::_("patch-class") -@core::pragma::_("origin-class") -class Class<@core::pragma::_("patch-class-type-variable") @core::pragma::_("origin-class-type-variable") T extends core::Object? = dynamic> extends core::Object { +class Class<@core::pragma::_("origin-class-type-variable") @core::pragma::_("patch-class-type-variable") T extends core::Object? = dynamic> extends core::Object { + @/* from org-dartlang-testcase:///origin_lib.dart */ const core::pragma::_("origin-constructor") @_in::patch @core::pragma::_("patch-constructor") - @/* from org-dartlang-testcase:///origin_lib.dart */ const core::pragma::_("origin-constructor") external constructor •() → self2::Class; + @/* from org-dartlang-testcase:///origin_lib.dart */ const core::pragma::_("origin-procedure") @_in::patch @core::pragma::_("patch-procedure") - @/* from org-dartlang-testcase:///origin_lib.dart */ const core::pragma::_("origin-procedure") external method method<@core::pragma::_("origin-method-type-variable") S extends core::Object? = dynamic>() → void; } Extra constant evaluation status: -Evaluated: FileUriExpression @ org-dartlang-testcase:///patch_lib.dart:5:1 -> InstanceConstant(const pragma{pragma.name: "patch-library", pragma.options: null}) Evaluated: ConstructorInvocation @ org-dartlang-testcase:///origin_lib.dart:5:2 -> InstanceConstant(const pragma{pragma.name: "origin-library", pragma.options: null}) -Evaluated: FileUriExpression @ org-dartlang-testcase:///patch_lib.dart:11:1 -> InstanceConstant(const _Patch{}) -Evaluated: FileUriExpression @ org-dartlang-testcase:///patch_lib.dart:12:1 -> InstanceConstant(const pragma{pragma.name: "patch-class", pragma.options: null}) Evaluated: ConstructorInvocation @ org-dartlang-testcase:///origin_lib.dart:8:2 -> InstanceConstant(const pragma{pragma.name: "origin-class", pragma.options: null}) -Evaluated: ConstructorInvocation @ org-dartlang-testcase:///origin_lib.dart:10:25 -> InstanceConstant(const pragma{pragma.name: "patch-class-type-variable", pragma.options: null}) +Evaluated: FileUriExpression @ org-dartlang-testcase:///patch_lib.dart:8:1 -> InstanceConstant(const _Patch{}) +Evaluated: FileUriExpression @ org-dartlang-testcase:///patch_lib.dart:9:1 -> InstanceConstant(const pragma{pragma.name: "patch-class", pragma.options: null}) Evaluated: ConstructorInvocation @ org-dartlang-testcase:///origin_lib.dart:9:14 -> InstanceConstant(const pragma{pragma.name: "origin-class-type-variable", pragma.options: null}) -Evaluated: StaticGet @ org-dartlang-testcase:///origin_lib.dart:13:16 -> InstanceConstant(const _Patch{}) -Evaluated: ConstructorInvocation @ org-dartlang-testcase:///origin_lib.dart:13:25 -> InstanceConstant(const pragma{pragma.name: "patch-constructor", pragma.options: null}) +Evaluated: ConstructorInvocation @ org-dartlang-testcase:///origin_lib.dart:9:45 -> InstanceConstant(const pragma{pragma.name: "patch-class-type-variable", pragma.options: null}) Evaluated: FileUriExpression @ org-dartlang-testcase:///origin_lib.dart:10:3 -> InstanceConstant(const pragma{pragma.name: "origin-constructor", pragma.options: null}) -Evaluated: StaticGet @ org-dartlang-testcase:///origin_lib.dart:14:47 -> InstanceConstant(const _Patch{}) -Evaluated: ConstructorInvocation @ org-dartlang-testcase:///origin_lib.dart:14:56 -> InstanceConstant(const pragma{pragma.name: "patch-procedure", pragma.options: null}) +Evaluated: StaticGet @ org-dartlang-testcase:///origin_lib.dart:11:2 -> InstanceConstant(const _Patch{}) +Evaluated: ConstructorInvocation @ org-dartlang-testcase:///origin_lib.dart:11:11 -> InstanceConstant(const pragma{pragma.name: "patch-constructor", pragma.options: null}) Evaluated: FileUriExpression @ org-dartlang-testcase:///origin_lib.dart:13:3 -> InstanceConstant(const pragma{pragma.name: "origin-procedure", pragma.options: null}) +Evaluated: StaticGet @ org-dartlang-testcase:///origin_lib.dart:14:12 -> InstanceConstant(const _Patch{}) +Evaluated: ConstructorInvocation @ org-dartlang-testcase:///origin_lib.dart:14:21 -> InstanceConstant(const pragma{pragma.name: "patch-procedure", pragma.options: null}) Evaluated: ConstructorInvocation @ org-dartlang-testcase:///origin_lib.dart:14:25 -> InstanceConstant(const pragma{pragma.name: "origin-method-type-variable", pragma.options: null}) -Extra constant evaluation: evaluated: 14, effectively constant: 14 +Extra constant evaluation: evaluated: 13, effectively constant: 13 diff --git a/pkg/front_end/testcases/general/patch_annotations/main.dart.strong.transformed.expect b/pkg/front_end/testcases/general/patch_annotations/main.dart.strong.transformed.expect index 87f593437d7..c4c9ff3bede 100644 --- a/pkg/front_end/testcases/general/patch_annotations/main.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/general/patch_annotations/main.dart.strong.transformed.expect @@ -5,8 +5,7 @@ import "dart:test"; static method main() → dynamic {} -@/* from org-dartlang-testcase:///patch_lib.dart */ #C3 -@#C5 +@#C3 library; import self as self2; import "dart:core" as core; @@ -14,45 +13,43 @@ import "dart:_internal" as _in; import "dart:_internal"; +@#C5 @/* from org-dartlang-testcase:///patch_lib.dart */ #C6 @/* from org-dartlang-testcase:///patch_lib.dart */ #C8 -@#C10 -class Class<@#C12 @#C14 T extends core::Object? = dynamic> extends core::Object { +class Class<@#C10 @#C12 T extends core::Object? = dynamic> extends core::Object { + @/* from org-dartlang-testcase:///origin_lib.dart */ #C14 @#C6 @#C16 - @/* from org-dartlang-testcase:///origin_lib.dart */ #C18 external constructor /* from org-dartlang-testcase:///patch_lib.dart */ •() → self2::Class; + @/* from org-dartlang-testcase:///origin_lib.dart */ #C18 @#C6 @#C20 - @/* from org-dartlang-testcase:///origin_lib.dart */ #C22 - external method /* from org-dartlang-testcase:///patch_lib.dart */ method<@#C24 S extends core::Object? = dynamic>() → void; + external method /* from org-dartlang-testcase:///patch_lib.dart */ method<@#C22 S extends core::Object? = dynamic>() → void; } constants { - #C1 = "patch-library" + #C1 = "origin-library" #C2 = null #C3 = core::pragma {name:#C1, options:#C2} - #C4 = "origin-library" + #C4 = "origin-class" #C5 = core::pragma {name:#C4, options:#C2} #C6 = _in::_Patch {} #C7 = "patch-class" #C8 = core::pragma {name:#C7, options:#C2} - #C9 = "origin-class" + #C9 = "origin-class-type-variable" #C10 = core::pragma {name:#C9, options:#C2} #C11 = "patch-class-type-variable" #C12 = core::pragma {name:#C11, options:#C2} - #C13 = "origin-class-type-variable" + #C13 = "origin-constructor" #C14 = core::pragma {name:#C13, options:#C2} #C15 = "patch-constructor" #C16 = core::pragma {name:#C15, options:#C2} - #C17 = "origin-constructor" + #C17 = "origin-procedure" #C18 = core::pragma {name:#C17, options:#C2} #C19 = "patch-procedure" #C20 = core::pragma {name:#C19, options:#C2} - #C21 = "origin-procedure" + #C21 = "patch-method-type-variable" #C22 = core::pragma {name:#C21, options:#C2} - #C23 = "patch-method-type-variable" - #C24 = core::pragma {name:#C23, options:#C2} } diff --git a/pkg/front_end/testcases/general/patch_annotations/patch_lib.dart b/pkg/front_end/testcases/general/patch_annotations/patch_lib.dart index 717ed232d4f..eb0ef6104a6 100644 --- a/pkg/front_end/testcases/general/patch_annotations/patch_lib.dart +++ b/pkg/front_end/testcases/general/patch_annotations/patch_lib.dart @@ -2,9 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -@pragma('patch-library') -library; - // ignore: import_internal_library import 'dart:_internal'; diff --git a/pkg/front_end/testcases/general/patch_conflict/main.dart.strong.expect b/pkg/front_end/testcases/general/patch_conflict/main.dart.strong.expect index ca13ee57b69..cc2093cb60e 100644 --- a/pkg/front_end/testcases/general/patch_conflict/main.dart.strong.expect +++ b/pkg/front_end/testcases/general/patch_conflict/main.dart.strong.expect @@ -9,70 +9,95 @@ library; // // Problems in library: // -// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:16:8: Error: Patch member 'missingOriginMethod' doesn't match a member in the origin class. -// Try changing the name to an existing member or removing the '@patch' annotation. -// void missingOriginMethod() {} /* Error: missing origin method */ -// ^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:30:6: Error: 'existingOriginMethod' is already declared in this scope. +// void existingOriginMethod() {} /* Error: conflict with origin method */ +// ^^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:13:6: Context: Previous declaration of 'existingOriginMethod'. +// void existingOriginMethod() {} +// ^^^^^^^^^^^^^^^^^^^^ // -// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:18:8: Error: Member 'existingOriginMethod' conflicts with an existing member of the same name in the origin class. -// Try changing the name of the member or adding an '@patch' annotation. -// void existingOriginMethod() {} /* Error: conflict with origin method */ -// ^^^^^^^^^^^^^^^^^^^^ -// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:10:8: Context: This is the existing member. -// void existingOriginMethod() {} -// ^^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:30:6: Error: Can't inject public 'existingOriginMethod' into 'dart:test'. +// Make 'existingOriginMethod' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). +// void existingOriginMethod() {} /* Error: conflict with origin method */ +// ^ // -// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:11:3: Error: Patch constructor 'Class.missingOriginConstructor' doesn't match a constructor in the origin class. -// Try changing the name to an existing constructor or removing the '@patch' annotation. -// Class.missingOriginConstructor(); /* Error: missing origin class */ -// ^ +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:32:7: Error: 'existingOriginDeclaration' is already declared in this scope. +// class existingOriginDeclaration {} /* Error: conflict with origin declaration */ +// ^^^^^^^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:15:6: Context: Previous declaration of 'existingOriginDeclaration'. +// void existingOriginDeclaration() {} +// ^^^^^^^^^^^^^^^^^^^^^^^^^ // -// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:13:3: Error: Constructor 'Class.existingOriginConstructor' conflicts with an existing constructor of the same name in the origin class. -// Try changing the name of the constructor or adding an '@patch' annotation. -// Class.existingOriginConstructor(); /* Error: conflict with origin class */ -// ^ -// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:8:3: Context: This is the existing constructor. -// Class.existingOriginConstructor(); -// ^ +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:32:7: Error: Can't inject public 'existingOriginDeclaration' into 'dart:test'. +// Make 'existingOriginDeclaration' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). +// class existingOriginDeclaration {} /* Error: conflict with origin declaration */ +// ^ +// +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:34:7: Error: 'ExistingOriginClass' is already declared in this scope. +// class ExistingOriginClass {} /* Error: conflict with origin class */ +// ^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:17:7: Context: Previous declaration of 'ExistingOriginClass'. +// class ExistingOriginClass {} +// ^^^^^^^^^^^^^^^^^^^ +// +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:34:7: Error: Can't inject public 'ExistingOriginClass' into 'dart:test'. +// Make 'ExistingOriginClass' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). +// class ExistingOriginClass {} /* Error: conflict with origin class */ +// ^ // // pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:22:6: Error: Patch member 'missingOriginMethod' doesn't match a member in the origin library. // Try changing the name to an existing member or removing the '@patch' annotation. // void missingOriginMethod() {} /* Error: missing origin method */ -// ^^^^^^^^^^^^^^^^^^^ +// ^ +// +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:22:6: Error: Can't inject public 'missingOriginMethod' into 'dart:test'. +// Make 'missingOriginMethod' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). +// void missingOriginMethod() {} /* Error: missing origin method */ +// ^ // // pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:25:7: Error: Patch class 'MissingOriginClass' doesn't match a class in the origin library. // Try changing the name to an existing class or removing the '@patch' annotation. // class MissingOriginClass {} /* Error: missing origin class */ -// ^^^^^^^^^^^^^^^^^^ +// ^ +// +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:25:7: Error: Can't inject public 'MissingOriginClass' into 'dart:test'. +// Make 'MissingOriginClass' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). +// class MissingOriginClass {} /* Error: missing origin class */ +// ^ // // pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:28:11: Error: Patch 'MissingOriginExtension' doesn't match a declaration in the origin library. // Try changing the name to an existing declaration or removing the '@patch' annotation. // extension MissingOriginExtension on int {} /* Error: missing origin extension */ -// ^^^^^^^^^^^^^^^^^^^^^^ +// ^ // -// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:30:6: Error: Member 'existingOriginMethod' conflicts with an existing member of the same name in the origin library. -// Try changing the name of the member or adding an '@patch' annotation. -// void existingOriginMethod() {} /* Error: conflict with origin method */ -// ^^^^^^^^^^^^^^^^^^^^ -// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:13:6: Context: This is the existing member. -// void existingOriginMethod() {} -// ^^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:28:11: Error: Can't inject public 'MissingOriginExtension' into 'dart:test'. +// Make 'MissingOriginExtension' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). +// extension MissingOriginExtension on int {} /* Error: missing origin extension */ +// ^ // -// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:32:7: Error: Declaration 'existingOriginDeclaration' conflicts with an existing declaration of the same name in the origin library. -// Try changing the name of the declaration. -// class existingOriginDeclaration {} /* Error: conflict with origin declaration */ -// ^^^^^^^^^^^^^^^^^^^^^^^^^ -// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:15:6: Context: This is the existing member. -// void existingOriginDeclaration() {} -// ^^^^^^^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:13:3: Error: 'Class.existingOriginConstructor' is already declared in this scope. +// Class.existingOriginConstructor(); /* Error: conflict with origin class */ +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:8:3: Context: Previous declaration of 'Class.existingOriginConstructor'. +// Class.existingOriginConstructor(); +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:34:7: Error: Class 'ExistingOriginClass' conflicts with an existing class of the same name in the origin library. -// Try changing the name of the class or adding an '@patch' annotation. -// class ExistingOriginClass {} /* Error: conflict with origin class */ -// ^^^^^^^^^^^^^^^^^^^ -// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:17:7: Context: This is the existing class. -// class ExistingOriginClass {} -// ^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:18:8: Error: 'existingOriginMethod' is already declared in this scope. +// void existingOriginMethod() {} /* Error: conflict with origin method */ +// ^^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:10:8: Context: Previous declaration of 'existingOriginMethod'. +// void existingOriginMethod() {} +// ^^^^^^^^^^^^^^^^^^^^ +// +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:11:3: Error: Patch member 'missingOriginConstructor' doesn't match a member in the origin class. +// Try changing the name to an existing member or removing the '@patch' annotation. +// Class.missingOriginConstructor(); /* Error: missing origin class */ +// ^ +// +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:16:8: Error: Patch member 'missingOriginMethod' doesn't match a member in the origin class. +// Try changing the name to an existing member or removing the '@patch' annotation. +// void missingOriginMethod() {} /* Error: missing origin method */ +// ^ // import self as self2; import "dart:_internal" as _in; @@ -80,51 +105,50 @@ import "dart:core" as core; import "dart:_internal"; -@#C1 -class MissingOriginClass extends core::Object { // from org-dartlang-testcase:///patch_lib.dart - synthetic constructor •() → self2::MissingOriginClass - : super core::Object::•() - ; -} -class existingOriginDeclaration#0#1 extends core::Object { // from org-dartlang-testcase:///patch_lib.dart - synthetic constructor •() → self2::existingOriginDeclaration#0#1 - : super core::Object::•() - ; -} -class ExistingOriginClass#0#1 extends core::Object { // from org-dartlang-testcase:///patch_lib.dart - synthetic constructor •() → self2::ExistingOriginClass#0#1 - : super core::Object::•() - ; -} @/* from org-dartlang-testcase:///patch_lib.dart */ #C1 class Class extends core::Object { - @#C1 - constructor /* from org-dartlang-testcase:///patch_lib.dart */ missingOriginConstructor() → self2::Class - : super core::Object::•() - ; constructor •() → self2::Class : super core::Object::•() ; constructor existingOriginConstructor() → self2::Class : super core::Object::•() ; + @#C1 + constructor /* from org-dartlang-testcase:///patch_lib.dart */ missingOriginConstructor() → self2::Class + : super core::Object::•() + ; method existingOriginMethod() → void {} @#C1 method /* from org-dartlang-testcase:///patch_lib.dart */ missingOriginMethod() → void {} } +class existingOriginDeclaration#1#0 extends core::Object { // from org-dartlang-testcase:///patch_lib.dart + synthetic constructor •() → self2::existingOriginDeclaration#1#0 + : super core::Object::•() + ; +} +class ExistingOriginClass#1#0 extends core::Object { // from org-dartlang-testcase:///patch_lib.dart + synthetic constructor •() → self2::ExistingOriginClass#1#0 + : super core::Object::•() + ; +} class ExistingOriginClass extends core::Object { synthetic constructor •() → self2::ExistingOriginClass : super core::Object::•() ; } @#C1 +class _#MissingOriginClass#augmentationWithoutOrigin0 extends core::Object { // from org-dartlang-testcase:///patch_lib.dart + synthetic constructor •() → self2::_#MissingOriginClass#augmentationWithoutOrigin0 + : super core::Object::•() + ; +} +@#C1 extension MissingOriginExtension on core::int { // from org-dartlang-testcase:///patch_lib.dart } static method existingOriginMethod() → void {} static method existingOriginDeclaration() → void {} @#C1 static method /* from org-dartlang-testcase:///patch_lib.dart */ missingOriginMethod() → void {} -static method /* from org-dartlang-testcase:///patch_lib.dart */ existingOriginMethod#1() → void {} constants { #C1 = _in::_Patch {} diff --git a/pkg/front_end/testcases/general/patch_conflict/main.dart.strong.modular.expect b/pkg/front_end/testcases/general/patch_conflict/main.dart.strong.modular.expect index ca13ee57b69..cc2093cb60e 100644 --- a/pkg/front_end/testcases/general/patch_conflict/main.dart.strong.modular.expect +++ b/pkg/front_end/testcases/general/patch_conflict/main.dart.strong.modular.expect @@ -9,70 +9,95 @@ library; // // Problems in library: // -// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:16:8: Error: Patch member 'missingOriginMethod' doesn't match a member in the origin class. -// Try changing the name to an existing member or removing the '@patch' annotation. -// void missingOriginMethod() {} /* Error: missing origin method */ -// ^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:30:6: Error: 'existingOriginMethod' is already declared in this scope. +// void existingOriginMethod() {} /* Error: conflict with origin method */ +// ^^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:13:6: Context: Previous declaration of 'existingOriginMethod'. +// void existingOriginMethod() {} +// ^^^^^^^^^^^^^^^^^^^^ // -// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:18:8: Error: Member 'existingOriginMethod' conflicts with an existing member of the same name in the origin class. -// Try changing the name of the member or adding an '@patch' annotation. -// void existingOriginMethod() {} /* Error: conflict with origin method */ -// ^^^^^^^^^^^^^^^^^^^^ -// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:10:8: Context: This is the existing member. -// void existingOriginMethod() {} -// ^^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:30:6: Error: Can't inject public 'existingOriginMethod' into 'dart:test'. +// Make 'existingOriginMethod' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). +// void existingOriginMethod() {} /* Error: conflict with origin method */ +// ^ // -// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:11:3: Error: Patch constructor 'Class.missingOriginConstructor' doesn't match a constructor in the origin class. -// Try changing the name to an existing constructor or removing the '@patch' annotation. -// Class.missingOriginConstructor(); /* Error: missing origin class */ -// ^ +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:32:7: Error: 'existingOriginDeclaration' is already declared in this scope. +// class existingOriginDeclaration {} /* Error: conflict with origin declaration */ +// ^^^^^^^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:15:6: Context: Previous declaration of 'existingOriginDeclaration'. +// void existingOriginDeclaration() {} +// ^^^^^^^^^^^^^^^^^^^^^^^^^ // -// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:13:3: Error: Constructor 'Class.existingOriginConstructor' conflicts with an existing constructor of the same name in the origin class. -// Try changing the name of the constructor or adding an '@patch' annotation. -// Class.existingOriginConstructor(); /* Error: conflict with origin class */ -// ^ -// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:8:3: Context: This is the existing constructor. -// Class.existingOriginConstructor(); -// ^ +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:32:7: Error: Can't inject public 'existingOriginDeclaration' into 'dart:test'. +// Make 'existingOriginDeclaration' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). +// class existingOriginDeclaration {} /* Error: conflict with origin declaration */ +// ^ +// +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:34:7: Error: 'ExistingOriginClass' is already declared in this scope. +// class ExistingOriginClass {} /* Error: conflict with origin class */ +// ^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:17:7: Context: Previous declaration of 'ExistingOriginClass'. +// class ExistingOriginClass {} +// ^^^^^^^^^^^^^^^^^^^ +// +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:34:7: Error: Can't inject public 'ExistingOriginClass' into 'dart:test'. +// Make 'ExistingOriginClass' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). +// class ExistingOriginClass {} /* Error: conflict with origin class */ +// ^ // // pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:22:6: Error: Patch member 'missingOriginMethod' doesn't match a member in the origin library. // Try changing the name to an existing member or removing the '@patch' annotation. // void missingOriginMethod() {} /* Error: missing origin method */ -// ^^^^^^^^^^^^^^^^^^^ +// ^ +// +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:22:6: Error: Can't inject public 'missingOriginMethod' into 'dart:test'. +// Make 'missingOriginMethod' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). +// void missingOriginMethod() {} /* Error: missing origin method */ +// ^ // // pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:25:7: Error: Patch class 'MissingOriginClass' doesn't match a class in the origin library. // Try changing the name to an existing class or removing the '@patch' annotation. // class MissingOriginClass {} /* Error: missing origin class */ -// ^^^^^^^^^^^^^^^^^^ +// ^ +// +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:25:7: Error: Can't inject public 'MissingOriginClass' into 'dart:test'. +// Make 'MissingOriginClass' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). +// class MissingOriginClass {} /* Error: missing origin class */ +// ^ // // pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:28:11: Error: Patch 'MissingOriginExtension' doesn't match a declaration in the origin library. // Try changing the name to an existing declaration or removing the '@patch' annotation. // extension MissingOriginExtension on int {} /* Error: missing origin extension */ -// ^^^^^^^^^^^^^^^^^^^^^^ +// ^ // -// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:30:6: Error: Member 'existingOriginMethod' conflicts with an existing member of the same name in the origin library. -// Try changing the name of the member or adding an '@patch' annotation. -// void existingOriginMethod() {} /* Error: conflict with origin method */ -// ^^^^^^^^^^^^^^^^^^^^ -// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:13:6: Context: This is the existing member. -// void existingOriginMethod() {} -// ^^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:28:11: Error: Can't inject public 'MissingOriginExtension' into 'dart:test'. +// Make 'MissingOriginExtension' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). +// extension MissingOriginExtension on int {} /* Error: missing origin extension */ +// ^ // -// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:32:7: Error: Declaration 'existingOriginDeclaration' conflicts with an existing declaration of the same name in the origin library. -// Try changing the name of the declaration. -// class existingOriginDeclaration {} /* Error: conflict with origin declaration */ -// ^^^^^^^^^^^^^^^^^^^^^^^^^ -// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:15:6: Context: This is the existing member. -// void existingOriginDeclaration() {} -// ^^^^^^^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:13:3: Error: 'Class.existingOriginConstructor' is already declared in this scope. +// Class.existingOriginConstructor(); /* Error: conflict with origin class */ +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:8:3: Context: Previous declaration of 'Class.existingOriginConstructor'. +// Class.existingOriginConstructor(); +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:34:7: Error: Class 'ExistingOriginClass' conflicts with an existing class of the same name in the origin library. -// Try changing the name of the class or adding an '@patch' annotation. -// class ExistingOriginClass {} /* Error: conflict with origin class */ -// ^^^^^^^^^^^^^^^^^^^ -// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:17:7: Context: This is the existing class. -// class ExistingOriginClass {} -// ^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:18:8: Error: 'existingOriginMethod' is already declared in this scope. +// void existingOriginMethod() {} /* Error: conflict with origin method */ +// ^^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:10:8: Context: Previous declaration of 'existingOriginMethod'. +// void existingOriginMethod() {} +// ^^^^^^^^^^^^^^^^^^^^ +// +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:11:3: Error: Patch member 'missingOriginConstructor' doesn't match a member in the origin class. +// Try changing the name to an existing member or removing the '@patch' annotation. +// Class.missingOriginConstructor(); /* Error: missing origin class */ +// ^ +// +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:16:8: Error: Patch member 'missingOriginMethod' doesn't match a member in the origin class. +// Try changing the name to an existing member or removing the '@patch' annotation. +// void missingOriginMethod() {} /* Error: missing origin method */ +// ^ // import self as self2; import "dart:_internal" as _in; @@ -80,51 +105,50 @@ import "dart:core" as core; import "dart:_internal"; -@#C1 -class MissingOriginClass extends core::Object { // from org-dartlang-testcase:///patch_lib.dart - synthetic constructor •() → self2::MissingOriginClass - : super core::Object::•() - ; -} -class existingOriginDeclaration#0#1 extends core::Object { // from org-dartlang-testcase:///patch_lib.dart - synthetic constructor •() → self2::existingOriginDeclaration#0#1 - : super core::Object::•() - ; -} -class ExistingOriginClass#0#1 extends core::Object { // from org-dartlang-testcase:///patch_lib.dart - synthetic constructor •() → self2::ExistingOriginClass#0#1 - : super core::Object::•() - ; -} @/* from org-dartlang-testcase:///patch_lib.dart */ #C1 class Class extends core::Object { - @#C1 - constructor /* from org-dartlang-testcase:///patch_lib.dart */ missingOriginConstructor() → self2::Class - : super core::Object::•() - ; constructor •() → self2::Class : super core::Object::•() ; constructor existingOriginConstructor() → self2::Class : super core::Object::•() ; + @#C1 + constructor /* from org-dartlang-testcase:///patch_lib.dart */ missingOriginConstructor() → self2::Class + : super core::Object::•() + ; method existingOriginMethod() → void {} @#C1 method /* from org-dartlang-testcase:///patch_lib.dart */ missingOriginMethod() → void {} } +class existingOriginDeclaration#1#0 extends core::Object { // from org-dartlang-testcase:///patch_lib.dart + synthetic constructor •() → self2::existingOriginDeclaration#1#0 + : super core::Object::•() + ; +} +class ExistingOriginClass#1#0 extends core::Object { // from org-dartlang-testcase:///patch_lib.dart + synthetic constructor •() → self2::ExistingOriginClass#1#0 + : super core::Object::•() + ; +} class ExistingOriginClass extends core::Object { synthetic constructor •() → self2::ExistingOriginClass : super core::Object::•() ; } @#C1 +class _#MissingOriginClass#augmentationWithoutOrigin0 extends core::Object { // from org-dartlang-testcase:///patch_lib.dart + synthetic constructor •() → self2::_#MissingOriginClass#augmentationWithoutOrigin0 + : super core::Object::•() + ; +} +@#C1 extension MissingOriginExtension on core::int { // from org-dartlang-testcase:///patch_lib.dart } static method existingOriginMethod() → void {} static method existingOriginDeclaration() → void {} @#C1 static method /* from org-dartlang-testcase:///patch_lib.dart */ missingOriginMethod() → void {} -static method /* from org-dartlang-testcase:///patch_lib.dart */ existingOriginMethod#1() → void {} constants { #C1 = _in::_Patch {} diff --git a/pkg/front_end/testcases/general/patch_conflict/main.dart.strong.outline.expect b/pkg/front_end/testcases/general/patch_conflict/main.dart.strong.outline.expect index d0b30cb1608..5e56c1bb308 100644 --- a/pkg/front_end/testcases/general/patch_conflict/main.dart.strong.outline.expect +++ b/pkg/front_end/testcases/general/patch_conflict/main.dart.strong.outline.expect @@ -10,70 +10,95 @@ library; // // Problems in library: // -// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:16:8: Error: Patch member 'missingOriginMethod' doesn't match a member in the origin class. -// Try changing the name to an existing member or removing the '@patch' annotation. -// void missingOriginMethod() {} /* Error: missing origin method */ -// ^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:30:6: Error: 'existingOriginMethod' is already declared in this scope. +// void existingOriginMethod() {} /* Error: conflict with origin method */ +// ^^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:13:6: Context: Previous declaration of 'existingOriginMethod'. +// void existingOriginMethod() {} +// ^^^^^^^^^^^^^^^^^^^^ // -// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:18:8: Error: Member 'existingOriginMethod' conflicts with an existing member of the same name in the origin class. -// Try changing the name of the member or adding an '@patch' annotation. -// void existingOriginMethod() {} /* Error: conflict with origin method */ -// ^^^^^^^^^^^^^^^^^^^^ -// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:10:8: Context: This is the existing member. -// void existingOriginMethod() {} -// ^^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:30:6: Error: Can't inject public 'existingOriginMethod' into 'dart:test'. +// Make 'existingOriginMethod' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). +// void existingOriginMethod() {} /* Error: conflict with origin method */ +// ^ // -// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:11:3: Error: Patch constructor 'Class.missingOriginConstructor' doesn't match a constructor in the origin class. -// Try changing the name to an existing constructor or removing the '@patch' annotation. -// Class.missingOriginConstructor(); /* Error: missing origin class */ -// ^ +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:32:7: Error: 'existingOriginDeclaration' is already declared in this scope. +// class existingOriginDeclaration {} /* Error: conflict with origin declaration */ +// ^^^^^^^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:15:6: Context: Previous declaration of 'existingOriginDeclaration'. +// void existingOriginDeclaration() {} +// ^^^^^^^^^^^^^^^^^^^^^^^^^ // -// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:13:3: Error: Constructor 'Class.existingOriginConstructor' conflicts with an existing constructor of the same name in the origin class. -// Try changing the name of the constructor or adding an '@patch' annotation. -// Class.existingOriginConstructor(); /* Error: conflict with origin class */ -// ^ -// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:8:3: Context: This is the existing constructor. -// Class.existingOriginConstructor(); -// ^ +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:32:7: Error: Can't inject public 'existingOriginDeclaration' into 'dart:test'. +// Make 'existingOriginDeclaration' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). +// class existingOriginDeclaration {} /* Error: conflict with origin declaration */ +// ^ +// +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:34:7: Error: 'ExistingOriginClass' is already declared in this scope. +// class ExistingOriginClass {} /* Error: conflict with origin class */ +// ^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:17:7: Context: Previous declaration of 'ExistingOriginClass'. +// class ExistingOriginClass {} +// ^^^^^^^^^^^^^^^^^^^ +// +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:34:7: Error: Can't inject public 'ExistingOriginClass' into 'dart:test'. +// Make 'ExistingOriginClass' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). +// class ExistingOriginClass {} /* Error: conflict with origin class */ +// ^ // // pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:22:6: Error: Patch member 'missingOriginMethod' doesn't match a member in the origin library. // Try changing the name to an existing member or removing the '@patch' annotation. // void missingOriginMethod() {} /* Error: missing origin method */ -// ^^^^^^^^^^^^^^^^^^^ +// ^ +// +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:22:6: Error: Can't inject public 'missingOriginMethod' into 'dart:test'. +// Make 'missingOriginMethod' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). +// void missingOriginMethod() {} /* Error: missing origin method */ +// ^ // // pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:25:7: Error: Patch class 'MissingOriginClass' doesn't match a class in the origin library. // Try changing the name to an existing class or removing the '@patch' annotation. // class MissingOriginClass {} /* Error: missing origin class */ -// ^^^^^^^^^^^^^^^^^^ +// ^ +// +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:25:7: Error: Can't inject public 'MissingOriginClass' into 'dart:test'. +// Make 'MissingOriginClass' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). +// class MissingOriginClass {} /* Error: missing origin class */ +// ^ // // pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:28:11: Error: Patch 'MissingOriginExtension' doesn't match a declaration in the origin library. // Try changing the name to an existing declaration or removing the '@patch' annotation. // extension MissingOriginExtension on int {} /* Error: missing origin extension */ -// ^^^^^^^^^^^^^^^^^^^^^^ +// ^ // -// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:30:6: Error: Member 'existingOriginMethod' conflicts with an existing member of the same name in the origin library. -// Try changing the name of the member or adding an '@patch' annotation. -// void existingOriginMethod() {} /* Error: conflict with origin method */ -// ^^^^^^^^^^^^^^^^^^^^ -// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:13:6: Context: This is the existing member. -// void existingOriginMethod() {} -// ^^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:28:11: Error: Can't inject public 'MissingOriginExtension' into 'dart:test'. +// Make 'MissingOriginExtension' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). +// extension MissingOriginExtension on int {} /* Error: missing origin extension */ +// ^ // -// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:32:7: Error: Declaration 'existingOriginDeclaration' conflicts with an existing declaration of the same name in the origin library. -// Try changing the name of the declaration. -// class existingOriginDeclaration {} /* Error: conflict with origin declaration */ -// ^^^^^^^^^^^^^^^^^^^^^^^^^ -// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:15:6: Context: This is the existing member. -// void existingOriginDeclaration() {} -// ^^^^^^^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:13:3: Error: 'Class.existingOriginConstructor' is already declared in this scope. +// Class.existingOriginConstructor(); /* Error: conflict with origin class */ +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:8:3: Context: Previous declaration of 'Class.existingOriginConstructor'. +// Class.existingOriginConstructor(); +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:34:7: Error: Class 'ExistingOriginClass' conflicts with an existing class of the same name in the origin library. -// Try changing the name of the class or adding an '@patch' annotation. -// class ExistingOriginClass {} /* Error: conflict with origin class */ -// ^^^^^^^^^^^^^^^^^^^ -// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:17:7: Context: This is the existing class. -// class ExistingOriginClass {} -// ^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:18:8: Error: 'existingOriginMethod' is already declared in this scope. +// void existingOriginMethod() {} /* Error: conflict with origin method */ +// ^^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:10:8: Context: Previous declaration of 'existingOriginMethod'. +// void existingOriginMethod() {} +// ^^^^^^^^^^^^^^^^^^^^ +// +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:11:3: Error: Patch member 'missingOriginConstructor' doesn't match a member in the origin class. +// Try changing the name to an existing member or removing the '@patch' annotation. +// Class.missingOriginConstructor(); /* Error: missing origin class */ +// ^ +// +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:16:8: Error: Patch member 'missingOriginMethod' doesn't match a member in the origin class. +// Try changing the name to an existing member or removing the '@patch' annotation. +// void missingOriginMethod() {} /* Error: missing origin method */ +// ^ // import self as self2; import "dart:_internal" as _in; @@ -81,39 +106,39 @@ import "dart:core" as core; import "dart:_internal"; -@_in::patch -class MissingOriginClass extends core::Object { // from org-dartlang-testcase:///patch_lib.dart - synthetic constructor •() → self2::MissingOriginClass - ; -} -class existingOriginDeclaration#0#1 extends core::Object { // from org-dartlang-testcase:///patch_lib.dart - synthetic constructor •() → self2::existingOriginDeclaration#0#1 - ; -} -class ExistingOriginClass#0#1 extends core::Object { // from org-dartlang-testcase:///patch_lib.dart - synthetic constructor •() → self2::ExistingOriginClass#0#1 - ; -} @/* from org-dartlang-testcase:///patch_lib.dart */ _in::patch class Class extends core::Object { - @_in::patch - constructor /* from org-dartlang-testcase:///patch_lib.dart */ missingOriginConstructor() → self2::Class - ; constructor •() → self2::Class ; constructor existingOriginConstructor() → self2::Class ; + @_in::patch + constructor /* from org-dartlang-testcase:///patch_lib.dart */ missingOriginConstructor() → self2::Class + ; method existingOriginMethod() → void ; @_in::patch method /* from org-dartlang-testcase:///patch_lib.dart */ missingOriginMethod() → void ; } +class existingOriginDeclaration#1#0 extends core::Object { // from org-dartlang-testcase:///patch_lib.dart + synthetic constructor •() → self2::existingOriginDeclaration#1#0 + ; +} +class ExistingOriginClass#1#0 extends core::Object { // from org-dartlang-testcase:///patch_lib.dart + synthetic constructor •() → self2::ExistingOriginClass#1#0 + ; +} class ExistingOriginClass extends core::Object { synthetic constructor •() → self2::ExistingOriginClass ; } @_in::patch +class _#MissingOriginClass#augmentationWithoutOrigin0 extends core::Object { // from org-dartlang-testcase:///patch_lib.dart + synthetic constructor •() → self2::_#MissingOriginClass#augmentationWithoutOrigin0 + ; +} +@_in::patch extension MissingOriginExtension on core::int { // from org-dartlang-testcase:///patch_lib.dart } static method existingOriginMethod() → void @@ -123,15 +148,13 @@ static method existingOriginDeclaration() → void @_in::patch static method /* from org-dartlang-testcase:///patch_lib.dart */ missingOriginMethod() → void ; -static method /* from org-dartlang-testcase:///patch_lib.dart */ existingOriginMethod#1() → void - ; Extra constant evaluation status: -Evaluated: StaticGet @ org-dartlang-testcase:///patch_lib.dart:24:2 -> InstanceConstant(const _Patch{}) Evaluated: FileUriExpression @ org-dartlang-testcase:///patch_lib.dart:8:1 -> InstanceConstant(const _Patch{}) Evaluated: StaticGet @ org-dartlang-testcase:///patch_lib.dart:10:4 -> InstanceConstant(const _Patch{}) Evaluated: StaticGet @ org-dartlang-testcase:///patch_lib.dart:15:4 -> InstanceConstant(const _Patch{}) +Evaluated: StaticGet @ org-dartlang-testcase:///patch_lib.dart:24:2 -> InstanceConstant(const _Patch{}) Evaluated: StaticGet @ org-dartlang-testcase:///patch_lib.dart:27:2 -> InstanceConstant(const _Patch{}) Evaluated: StaticGet @ org-dartlang-testcase:///patch_lib.dart:21:2 -> InstanceConstant(const _Patch{}) Extra constant evaluation: evaluated: 6, effectively constant: 6 diff --git a/pkg/front_end/testcases/general/patch_conflict/main.dart.strong.transformed.expect b/pkg/front_end/testcases/general/patch_conflict/main.dart.strong.transformed.expect index ca13ee57b69..cc2093cb60e 100644 --- a/pkg/front_end/testcases/general/patch_conflict/main.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/general/patch_conflict/main.dart.strong.transformed.expect @@ -9,70 +9,95 @@ library; // // Problems in library: // -// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:16:8: Error: Patch member 'missingOriginMethod' doesn't match a member in the origin class. -// Try changing the name to an existing member or removing the '@patch' annotation. -// void missingOriginMethod() {} /* Error: missing origin method */ -// ^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:30:6: Error: 'existingOriginMethod' is already declared in this scope. +// void existingOriginMethod() {} /* Error: conflict with origin method */ +// ^^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:13:6: Context: Previous declaration of 'existingOriginMethod'. +// void existingOriginMethod() {} +// ^^^^^^^^^^^^^^^^^^^^ // -// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:18:8: Error: Member 'existingOriginMethod' conflicts with an existing member of the same name in the origin class. -// Try changing the name of the member or adding an '@patch' annotation. -// void existingOriginMethod() {} /* Error: conflict with origin method */ -// ^^^^^^^^^^^^^^^^^^^^ -// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:10:8: Context: This is the existing member. -// void existingOriginMethod() {} -// ^^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:30:6: Error: Can't inject public 'existingOriginMethod' into 'dart:test'. +// Make 'existingOriginMethod' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). +// void existingOriginMethod() {} /* Error: conflict with origin method */ +// ^ // -// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:11:3: Error: Patch constructor 'Class.missingOriginConstructor' doesn't match a constructor in the origin class. -// Try changing the name to an existing constructor or removing the '@patch' annotation. -// Class.missingOriginConstructor(); /* Error: missing origin class */ -// ^ +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:32:7: Error: 'existingOriginDeclaration' is already declared in this scope. +// class existingOriginDeclaration {} /* Error: conflict with origin declaration */ +// ^^^^^^^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:15:6: Context: Previous declaration of 'existingOriginDeclaration'. +// void existingOriginDeclaration() {} +// ^^^^^^^^^^^^^^^^^^^^^^^^^ // -// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:13:3: Error: Constructor 'Class.existingOriginConstructor' conflicts with an existing constructor of the same name in the origin class. -// Try changing the name of the constructor or adding an '@patch' annotation. -// Class.existingOriginConstructor(); /* Error: conflict with origin class */ -// ^ -// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:8:3: Context: This is the existing constructor. -// Class.existingOriginConstructor(); -// ^ +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:32:7: Error: Can't inject public 'existingOriginDeclaration' into 'dart:test'. +// Make 'existingOriginDeclaration' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). +// class existingOriginDeclaration {} /* Error: conflict with origin declaration */ +// ^ +// +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:34:7: Error: 'ExistingOriginClass' is already declared in this scope. +// class ExistingOriginClass {} /* Error: conflict with origin class */ +// ^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:17:7: Context: Previous declaration of 'ExistingOriginClass'. +// class ExistingOriginClass {} +// ^^^^^^^^^^^^^^^^^^^ +// +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:34:7: Error: Can't inject public 'ExistingOriginClass' into 'dart:test'. +// Make 'ExistingOriginClass' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). +// class ExistingOriginClass {} /* Error: conflict with origin class */ +// ^ // // pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:22:6: Error: Patch member 'missingOriginMethod' doesn't match a member in the origin library. // Try changing the name to an existing member or removing the '@patch' annotation. // void missingOriginMethod() {} /* Error: missing origin method */ -// ^^^^^^^^^^^^^^^^^^^ +// ^ +// +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:22:6: Error: Can't inject public 'missingOriginMethod' into 'dart:test'. +// Make 'missingOriginMethod' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). +// void missingOriginMethod() {} /* Error: missing origin method */ +// ^ // // pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:25:7: Error: Patch class 'MissingOriginClass' doesn't match a class in the origin library. // Try changing the name to an existing class or removing the '@patch' annotation. // class MissingOriginClass {} /* Error: missing origin class */ -// ^^^^^^^^^^^^^^^^^^ +// ^ +// +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:25:7: Error: Can't inject public 'MissingOriginClass' into 'dart:test'. +// Make 'MissingOriginClass' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). +// class MissingOriginClass {} /* Error: missing origin class */ +// ^ // // pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:28:11: Error: Patch 'MissingOriginExtension' doesn't match a declaration in the origin library. // Try changing the name to an existing declaration or removing the '@patch' annotation. // extension MissingOriginExtension on int {} /* Error: missing origin extension */ -// ^^^^^^^^^^^^^^^^^^^^^^ +// ^ // -// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:30:6: Error: Member 'existingOriginMethod' conflicts with an existing member of the same name in the origin library. -// Try changing the name of the member or adding an '@patch' annotation. -// void existingOriginMethod() {} /* Error: conflict with origin method */ -// ^^^^^^^^^^^^^^^^^^^^ -// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:13:6: Context: This is the existing member. -// void existingOriginMethod() {} -// ^^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:28:11: Error: Can't inject public 'MissingOriginExtension' into 'dart:test'. +// Make 'MissingOriginExtension' private, or make sure injected library has "dart" scheme and is private (e.g. "dart:_internal"). +// extension MissingOriginExtension on int {} /* Error: missing origin extension */ +// ^ // -// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:32:7: Error: Declaration 'existingOriginDeclaration' conflicts with an existing declaration of the same name in the origin library. -// Try changing the name of the declaration. -// class existingOriginDeclaration {} /* Error: conflict with origin declaration */ -// ^^^^^^^^^^^^^^^^^^^^^^^^^ -// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:15:6: Context: This is the existing member. -// void existingOriginDeclaration() {} -// ^^^^^^^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:13:3: Error: 'Class.existingOriginConstructor' is already declared in this scope. +// Class.existingOriginConstructor(); /* Error: conflict with origin class */ +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:8:3: Context: Previous declaration of 'Class.existingOriginConstructor'. +// Class.existingOriginConstructor(); +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:34:7: Error: Class 'ExistingOriginClass' conflicts with an existing class of the same name in the origin library. -// Try changing the name of the class or adding an '@patch' annotation. -// class ExistingOriginClass {} /* Error: conflict with origin class */ -// ^^^^^^^^^^^^^^^^^^^ -// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:17:7: Context: This is the existing class. -// class ExistingOriginClass {} -// ^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:18:8: Error: 'existingOriginMethod' is already declared in this scope. +// void existingOriginMethod() {} /* Error: conflict with origin method */ +// ^^^^^^^^^^^^^^^^^^^^ +// pkg/front_end/testcases/general/patch_conflict/origin_lib.dart:10:8: Context: Previous declaration of 'existingOriginMethod'. +// void existingOriginMethod() {} +// ^^^^^^^^^^^^^^^^^^^^ +// +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:11:3: Error: Patch member 'missingOriginConstructor' doesn't match a member in the origin class. +// Try changing the name to an existing member or removing the '@patch' annotation. +// Class.missingOriginConstructor(); /* Error: missing origin class */ +// ^ +// +// pkg/front_end/testcases/general/patch_conflict/patch_lib.dart:16:8: Error: Patch member 'missingOriginMethod' doesn't match a member in the origin class. +// Try changing the name to an existing member or removing the '@patch' annotation. +// void missingOriginMethod() {} /* Error: missing origin method */ +// ^ // import self as self2; import "dart:_internal" as _in; @@ -80,51 +105,50 @@ import "dart:core" as core; import "dart:_internal"; -@#C1 -class MissingOriginClass extends core::Object { // from org-dartlang-testcase:///patch_lib.dart - synthetic constructor •() → self2::MissingOriginClass - : super core::Object::•() - ; -} -class existingOriginDeclaration#0#1 extends core::Object { // from org-dartlang-testcase:///patch_lib.dart - synthetic constructor •() → self2::existingOriginDeclaration#0#1 - : super core::Object::•() - ; -} -class ExistingOriginClass#0#1 extends core::Object { // from org-dartlang-testcase:///patch_lib.dart - synthetic constructor •() → self2::ExistingOriginClass#0#1 - : super core::Object::•() - ; -} @/* from org-dartlang-testcase:///patch_lib.dart */ #C1 class Class extends core::Object { - @#C1 - constructor /* from org-dartlang-testcase:///patch_lib.dart */ missingOriginConstructor() → self2::Class - : super core::Object::•() - ; constructor •() → self2::Class : super core::Object::•() ; constructor existingOriginConstructor() → self2::Class : super core::Object::•() ; + @#C1 + constructor /* from org-dartlang-testcase:///patch_lib.dart */ missingOriginConstructor() → self2::Class + : super core::Object::•() + ; method existingOriginMethod() → void {} @#C1 method /* from org-dartlang-testcase:///patch_lib.dart */ missingOriginMethod() → void {} } +class existingOriginDeclaration#1#0 extends core::Object { // from org-dartlang-testcase:///patch_lib.dart + synthetic constructor •() → self2::existingOriginDeclaration#1#0 + : super core::Object::•() + ; +} +class ExistingOriginClass#1#0 extends core::Object { // from org-dartlang-testcase:///patch_lib.dart + synthetic constructor •() → self2::ExistingOriginClass#1#0 + : super core::Object::•() + ; +} class ExistingOriginClass extends core::Object { synthetic constructor •() → self2::ExistingOriginClass : super core::Object::•() ; } @#C1 +class _#MissingOriginClass#augmentationWithoutOrigin0 extends core::Object { // from org-dartlang-testcase:///patch_lib.dart + synthetic constructor •() → self2::_#MissingOriginClass#augmentationWithoutOrigin0 + : super core::Object::•() + ; +} +@#C1 extension MissingOriginExtension on core::int { // from org-dartlang-testcase:///patch_lib.dart } static method existingOriginMethod() → void {} static method existingOriginDeclaration() → void {} @#C1 static method /* from org-dartlang-testcase:///patch_lib.dart */ missingOriginMethod() → void {} -static method /* from org-dartlang-testcase:///patch_lib.dart */ existingOriginMethod#1() → void {} constants { #C1 = _in::_Patch {} diff --git a/pkg/front_end/testcases/general/patch_extends_implements/main.dart.strong.expect b/pkg/front_end/testcases/general/patch_extends_implements/main.dart.strong.expect index e04ff99de08..b93dd248adc 100644 --- a/pkg/front_end/testcases/general/patch_extends_implements/main.dart.strong.expect +++ b/pkg/front_end/testcases/general/patch_extends_implements/main.dart.strong.expect @@ -86,26 +86,6 @@ import "dart:_internal" as _in; import "dart:_internal"; -class _Class6aImpl extends core::Object { // from org-dartlang-testcase:///patch_lib.dart - constructor •((test::_Class6aImpl::T%) → void f) → test::_Class6aImpl - : super core::Object::•() - ; -} -class _Class6bImpl extends core::Object implements test::Class6b { // from org-dartlang-testcase:///patch_lib.dart - constructor •((test::_Class6bImpl::T%) → void f) → test::_Class6bImpl - : super core::Object::•() - ; -} -class _Class6cImpl extends core::Object { // from org-dartlang-testcase:///patch_lib.dart - constructor •((test::_Class6cImpl::T%) → void f) → test::_Class6cImpl - : super core::Object::•() - ; -} -abstract class _Class4b&Object&Mixin = core::Object with test::Mixin /*isAnonymousMixin,hasConstConstructor*/ { // from org-dartlang-testcase:///patch_lib.dart - const synthetic constructor •() → test::_Class4b&Object&Mixin - : super core::Object::•() - ; -} abstract class Interface extends core::Object { synthetic constructor •() → test::Interface : super core::Object::•() @@ -236,6 +216,21 @@ class Class6c extends core::Object { factory Class6c(void Function(T) f) = _Class6cImpl; ^"; } +class _Class6aImpl extends core::Object { // from org-dartlang-testcase:///patch_lib.dart + constructor •((test::_Class6aImpl::T%) → void f) → test::_Class6aImpl + : super core::Object::•() + ; +} +class _Class6bImpl extends core::Object implements test::Class6b { // from org-dartlang-testcase:///patch_lib.dart + constructor •((test::_Class6bImpl::T%) → void f) → test::_Class6bImpl + : super core::Object::•() + ; +} +class _Class6cImpl extends core::Object { // from org-dartlang-testcase:///patch_lib.dart + constructor •((test::_Class6cImpl::T%) → void f) → test::_Class6cImpl + : super core::Object::•() + ; +} abstract class _Class4a&Object&Mixin = core::Object with test::Mixin /*isAnonymousMixin,hasConstConstructor*/ { const synthetic constructor •() → test::_Class4a&Object&Mixin : super core::Object::•() diff --git a/pkg/front_end/testcases/general/patch_extends_implements/main.dart.strong.modular.expect b/pkg/front_end/testcases/general/patch_extends_implements/main.dart.strong.modular.expect index e04ff99de08..b93dd248adc 100644 --- a/pkg/front_end/testcases/general/patch_extends_implements/main.dart.strong.modular.expect +++ b/pkg/front_end/testcases/general/patch_extends_implements/main.dart.strong.modular.expect @@ -86,26 +86,6 @@ import "dart:_internal" as _in; import "dart:_internal"; -class _Class6aImpl extends core::Object { // from org-dartlang-testcase:///patch_lib.dart - constructor •((test::_Class6aImpl::T%) → void f) → test::_Class6aImpl - : super core::Object::•() - ; -} -class _Class6bImpl extends core::Object implements test::Class6b { // from org-dartlang-testcase:///patch_lib.dart - constructor •((test::_Class6bImpl::T%) → void f) → test::_Class6bImpl - : super core::Object::•() - ; -} -class _Class6cImpl extends core::Object { // from org-dartlang-testcase:///patch_lib.dart - constructor •((test::_Class6cImpl::T%) → void f) → test::_Class6cImpl - : super core::Object::•() - ; -} -abstract class _Class4b&Object&Mixin = core::Object with test::Mixin /*isAnonymousMixin,hasConstConstructor*/ { // from org-dartlang-testcase:///patch_lib.dart - const synthetic constructor •() → test::_Class4b&Object&Mixin - : super core::Object::•() - ; -} abstract class Interface extends core::Object { synthetic constructor •() → test::Interface : super core::Object::•() @@ -236,6 +216,21 @@ class Class6c extends core::Object { factory Class6c(void Function(T) f) = _Class6cImpl; ^"; } +class _Class6aImpl extends core::Object { // from org-dartlang-testcase:///patch_lib.dart + constructor •((test::_Class6aImpl::T%) → void f) → test::_Class6aImpl + : super core::Object::•() + ; +} +class _Class6bImpl extends core::Object implements test::Class6b { // from org-dartlang-testcase:///patch_lib.dart + constructor •((test::_Class6bImpl::T%) → void f) → test::_Class6bImpl + : super core::Object::•() + ; +} +class _Class6cImpl extends core::Object { // from org-dartlang-testcase:///patch_lib.dart + constructor •((test::_Class6cImpl::T%) → void f) → test::_Class6cImpl + : super core::Object::•() + ; +} abstract class _Class4a&Object&Mixin = core::Object with test::Mixin /*isAnonymousMixin,hasConstConstructor*/ { const synthetic constructor •() → test::_Class4a&Object&Mixin : super core::Object::•() diff --git a/pkg/front_end/testcases/general/patch_extends_implements/main.dart.strong.outline.expect b/pkg/front_end/testcases/general/patch_extends_implements/main.dart.strong.outline.expect index c07b92d9803..166cfb43f1e 100644 --- a/pkg/front_end/testcases/general/patch_extends_implements/main.dart.strong.outline.expect +++ b/pkg/front_end/testcases/general/patch_extends_implements/main.dart.strong.outline.expect @@ -40,23 +40,6 @@ import "dart:_internal" as _in; import "dart:_internal"; -class _Class6aImpl extends core::Object { // from org-dartlang-testcase:///patch_lib.dart - constructor •((self2::_Class6aImpl::T%) → void f) → self2::_Class6aImpl - ; -} -class _Class6bImpl extends core::Object implements self2::Class6b { // from org-dartlang-testcase:///patch_lib.dart - constructor •((self2::_Class6bImpl::T%) → void f) → self2::_Class6bImpl - ; -} -class _Class6cImpl extends core::Object { // from org-dartlang-testcase:///patch_lib.dart - constructor •((self2::_Class6cImpl::T%) → void f) → self2::_Class6cImpl - ; -} -abstract class _Class4b&Object&Mixin = core::Object with self2::Mixin /*isAnonymousMixin,hasConstConstructor*/ { // from org-dartlang-testcase:///patch_lib.dart - const synthetic constructor •() → self2::_Class4b&Object&Mixin - : super core::Object::•() - ; -} abstract class Interface extends core::Object { synthetic constructor •() → self2::Interface ; @@ -158,6 +141,18 @@ class Class6c extends core::Object { external static factory •((self2::Class6c::•::T%) → void f) → self2::Class6c return new self2::_Class6cImpl::•(f); } +class _Class6aImpl extends core::Object { // from org-dartlang-testcase:///patch_lib.dart + constructor •((self2::_Class6aImpl::T%) → void f) → self2::_Class6aImpl + ; +} +class _Class6bImpl extends core::Object implements self2::Class6b { // from org-dartlang-testcase:///patch_lib.dart + constructor •((self2::_Class6bImpl::T%) → void f) → self2::_Class6bImpl + ; +} +class _Class6cImpl extends core::Object { // from org-dartlang-testcase:///patch_lib.dart + constructor •((self2::_Class6cImpl::T%) → void f) → self2::_Class6cImpl + ; +} abstract class _Class4a&Object&Mixin = core::Object with self2::Mixin /*isAnonymousMixin,hasConstConstructor*/ { const synthetic constructor •() → self2::_Class4a&Object&Mixin : super core::Object::•() diff --git a/pkg/front_end/testcases/general/patch_extends_implements/main.dart.strong.transformed.expect b/pkg/front_end/testcases/general/patch_extends_implements/main.dart.strong.transformed.expect index 676db98c07e..6d002913787 100644 --- a/pkg/front_end/testcases/general/patch_extends_implements/main.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/general/patch_extends_implements/main.dart.strong.transformed.expect @@ -86,26 +86,6 @@ import "dart:_internal" as _in; import "dart:_internal"; -class _Class6aImpl extends core::Object { // from org-dartlang-testcase:///patch_lib.dart - constructor •((test::_Class6aImpl::T%) → void f) → test::_Class6aImpl - : super core::Object::•() - ; -} -class _Class6bImpl extends core::Object implements test::Class6b { // from org-dartlang-testcase:///patch_lib.dart - constructor •((test::_Class6bImpl::T%) → void f) → test::_Class6bImpl - : super core::Object::•() - ; -} -class _Class6cImpl extends core::Object { // from org-dartlang-testcase:///patch_lib.dart - constructor •((test::_Class6cImpl::T%) → void f) → test::_Class6cImpl - : super core::Object::•() - ; -} -abstract class _Class4b&Object&Mixin extends core::Object implements test::Mixin /*isAnonymousMixin,isEliminatedMixin,hasConstConstructor*/ { // from org-dartlang-testcase:///patch_lib.dart - const synthetic constructor •() → test::_Class4b&Object&Mixin - : super core::Object::•() - ; -} abstract class Interface extends core::Object { synthetic constructor •() → test::Interface : super core::Object::•() @@ -236,6 +216,21 @@ class Class6c extends core::Object { factory Class6c(void Function(T) f) = _Class6cImpl; ^"; } +class _Class6aImpl extends core::Object { // from org-dartlang-testcase:///patch_lib.dart + constructor •((test::_Class6aImpl::T%) → void f) → test::_Class6aImpl + : super core::Object::•() + ; +} +class _Class6bImpl extends core::Object implements test::Class6b { // from org-dartlang-testcase:///patch_lib.dart + constructor •((test::_Class6bImpl::T%) → void f) → test::_Class6bImpl + : super core::Object::•() + ; +} +class _Class6cImpl extends core::Object { // from org-dartlang-testcase:///patch_lib.dart + constructor •((test::_Class6cImpl::T%) → void f) → test::_Class6cImpl + : super core::Object::•() + ; +} abstract class _Class4a&Object&Mixin extends core::Object implements test::Mixin /*isAnonymousMixin,isEliminatedMixin,hasConstConstructor*/ { const synthetic constructor •() → test::_Class4a&Object&Mixin : super core::Object::•() diff --git a/pkg/front_end/testcases/general/patch_extension_scope/main.dart.strong.expect b/pkg/front_end/testcases/general/patch_extension_scope/main.dart.strong.expect index 2d098ecc70f..a8dc68c42db 100644 --- a/pkg/front_end/testcases/general/patch_extension_scope/main.dart.strong.expect +++ b/pkg/front_end/testcases/general/patch_extension_scope/main.dart.strong.expect @@ -147,95 +147,95 @@ class Class extends core::Object { method _method() → void { test::Extension|namedExtensionMethod(this); test::Extension|_namedExtensionPrivateMethod(this); - test::_extension#5|unnamedExtensionMethod(this); - test::_extension#5|_unnamedExtensionPrivateMethod(this); + test::_extension#3|unnamedExtensionMethod(this); + test::_extension#3|_unnamedExtensionPrivateMethod(this); test::NamedInjectedExtension1|namedInjectedExtensionMethod1(this); test::NamedInjectedExtension1|_namedInjectedExtensionPrivateMethod1(this); - test::_extension#1|unnamedInjectedExtensionMethod1(this); - test::_extension#1|_unnamedInjectedExtensionPrivateMethod1(this); + test::_extension#4|unnamedInjectedExtensionMethod1(this); + test::_extension#4|_unnamedInjectedExtensionPrivateMethod1(this); test::NamedInjectedExtension2|namedInjectedExtensionMethod2(this); test::NamedInjectedExtension2|_namedInjectedExtensionPrivateMethod2(this); - test::_extension#3|unnamedInjectedExtensionMethod2(this); - test::_extension#3|_unnamedInjectedExtensionPrivateMethod2(this); + test::_extension#5|unnamedInjectedExtensionMethod2(this); + test::_extension#5|_unnamedInjectedExtensionPrivateMethod2(this); } method /* from org-dartlang-testcase:///patch_lib1.dart */ _method1() → void { test::Extension|namedExtensionMethod(this); test::Extension|_namedExtensionPrivateMethod(this); - test::_extension#5|unnamedExtensionMethod(this); - test::_extension#5|_unnamedExtensionPrivateMethod(this); + test::_extension#3|unnamedExtensionMethod(this); + test::_extension#3|_unnamedExtensionPrivateMethod(this); test::NamedInjectedExtension1|namedInjectedExtensionMethod1(this); test::NamedInjectedExtension1|_namedInjectedExtensionPrivateMethod1(this); - test::_extension#1|unnamedInjectedExtensionMethod1(this); - test::_extension#1|_unnamedInjectedExtensionPrivateMethod1(this); + test::_extension#4|unnamedInjectedExtensionMethod1(this); + test::_extension#4|_unnamedInjectedExtensionPrivateMethod1(this); test::NamedInjectedExtension2|namedInjectedExtensionMethod2(this); test::NamedInjectedExtension2|_namedInjectedExtensionPrivateMethod2(this); - test::_extension#3|unnamedInjectedExtensionMethod2(this); - test::_extension#3|_unnamedInjectedExtensionPrivateMethod2(this); + test::_extension#5|unnamedInjectedExtensionMethod2(this); + test::_extension#5|_unnamedInjectedExtensionPrivateMethod2(this); } method /* from org-dartlang-testcase:///patch_lib2.dart */ _method2() → void { test::Extension|namedExtensionMethod(this); test::Extension|_namedExtensionPrivateMethod(this); - test::_extension#5|unnamedExtensionMethod(this); - test::_extension#5|_unnamedExtensionPrivateMethod(this); + test::_extension#3|unnamedExtensionMethod(this); + test::_extension#3|_unnamedExtensionPrivateMethod(this); test::NamedInjectedExtension1|namedInjectedExtensionMethod1(this); test::NamedInjectedExtension1|_namedInjectedExtensionPrivateMethod1(this); - test::_extension#1|unnamedInjectedExtensionMethod1(this); - test::_extension#1|_unnamedInjectedExtensionPrivateMethod1(this); + test::_extension#4|unnamedInjectedExtensionMethod1(this); + test::_extension#4|_unnamedInjectedExtensionPrivateMethod1(this); test::NamedInjectedExtension2|namedInjectedExtensionMethod2(this); test::NamedInjectedExtension2|_namedInjectedExtensionPrivateMethod2(this); - test::_extension#3|unnamedInjectedExtensionMethod2(this); - test::_extension#3|_unnamedInjectedExtensionPrivateMethod2(this); + test::_extension#5|unnamedInjectedExtensionMethod2(this); + test::_extension#5|_unnamedInjectedExtensionPrivateMethod2(this); } } -extension NamedInjectedExtension1 on test::Class { // from org-dartlang-testcase:///patch_lib1.dart - method namedInjectedExtensionMethod1 = test::NamedInjectedExtension1|namedInjectedExtensionMethod1; - method tearoff namedInjectedExtensionMethod1 = test::NamedInjectedExtension1|get#namedInjectedExtensionMethod1; - method _namedInjectedExtensionPrivateMethod1 = test::NamedInjectedExtension1|_namedInjectedExtensionPrivateMethod1; - method tearoff _namedInjectedExtensionPrivateMethod1 = test::NamedInjectedExtension1|get#_namedInjectedExtensionPrivateMethod1; -} -extension /* unnamed */ _extension#1 on test::Class { // from org-dartlang-testcase:///patch_lib1.dart - method unnamedInjectedExtensionMethod1 = test::_extension#1|unnamedInjectedExtensionMethod1; - method tearoff unnamedInjectedExtensionMethod1 = test::_extension#1|get#unnamedInjectedExtensionMethod1; - method _unnamedInjectedExtensionPrivateMethod1 = test::_extension#1|_unnamedInjectedExtensionPrivateMethod1; - method tearoff _unnamedInjectedExtensionPrivateMethod1 = test::_extension#1|get#_unnamedInjectedExtensionPrivateMethod1; -} -extension NamedInjectedExtension2 on test::Class { // from org-dartlang-testcase:///patch_lib2.dart - method namedInjectedExtensionMethod2 = test::NamedInjectedExtension2|namedInjectedExtensionMethod2; - method tearoff namedInjectedExtensionMethod2 = test::NamedInjectedExtension2|get#namedInjectedExtensionMethod2; - method _namedInjectedExtensionPrivateMethod2 = test::NamedInjectedExtension2|_namedInjectedExtensionPrivateMethod2; - method tearoff _namedInjectedExtensionPrivateMethod2 = test::NamedInjectedExtension2|get#_namedInjectedExtensionPrivateMethod2; -} -extension /* unnamed */ _extension#3 on test::Class { // from org-dartlang-testcase:///patch_lib2.dart - method unnamedInjectedExtensionMethod2 = test::_extension#3|unnamedInjectedExtensionMethod2; - method tearoff unnamedInjectedExtensionMethod2 = test::_extension#3|get#unnamedInjectedExtensionMethod2; - method _unnamedInjectedExtensionPrivateMethod2 = test::_extension#3|_unnamedInjectedExtensionPrivateMethod2; - method tearoff _unnamedInjectedExtensionPrivateMethod2 = test::_extension#3|get#_unnamedInjectedExtensionPrivateMethod2; -} extension Extension on test::Class { method namedExtensionMethod = test::Extension|namedExtensionMethod; method tearoff namedExtensionMethod = test::Extension|get#namedExtensionMethod; method _namedExtensionPrivateMethod = test::Extension|_namedExtensionPrivateMethod; method tearoff _namedExtensionPrivateMethod = test::Extension|get#_namedExtensionPrivateMethod; } -extension /* unnamed */ _extension#5 on test::Class { - method unnamedExtensionMethod = test::_extension#5|unnamedExtensionMethod; - method tearoff unnamedExtensionMethod = test::_extension#5|get#unnamedExtensionMethod; - method _unnamedExtensionPrivateMethod = test::_extension#5|_unnamedExtensionPrivateMethod; - method tearoff _unnamedExtensionPrivateMethod = test::_extension#5|get#_unnamedExtensionPrivateMethod; +extension NamedInjectedExtension1 on test::Class { // from org-dartlang-testcase:///patch_lib1.dart + method namedInjectedExtensionMethod1 = test::NamedInjectedExtension1|namedInjectedExtensionMethod1; + method tearoff namedInjectedExtensionMethod1 = test::NamedInjectedExtension1|get#namedInjectedExtensionMethod1; + method _namedInjectedExtensionPrivateMethod1 = test::NamedInjectedExtension1|_namedInjectedExtensionPrivateMethod1; + method tearoff _namedInjectedExtensionPrivateMethod1 = test::NamedInjectedExtension1|get#_namedInjectedExtensionPrivateMethod1; +} +extension NamedInjectedExtension2 on test::Class { // from org-dartlang-testcase:///patch_lib2.dart + method namedInjectedExtensionMethod2 = test::NamedInjectedExtension2|namedInjectedExtensionMethod2; + method tearoff namedInjectedExtensionMethod2 = test::NamedInjectedExtension2|get#namedInjectedExtensionMethod2; + method _namedInjectedExtensionPrivateMethod2 = test::NamedInjectedExtension2|_namedInjectedExtensionPrivateMethod2; + method tearoff _namedInjectedExtensionPrivateMethod2 = test::NamedInjectedExtension2|get#_namedInjectedExtensionPrivateMethod2; +} +extension /* unnamed */ _extension#3 on test::Class { + method unnamedExtensionMethod = test::_extension#3|unnamedExtensionMethod; + method tearoff unnamedExtensionMethod = test::_extension#3|get#unnamedExtensionMethod; + method _unnamedExtensionPrivateMethod = test::_extension#3|_unnamedExtensionPrivateMethod; + method tearoff _unnamedExtensionPrivateMethod = test::_extension#3|get#_unnamedExtensionPrivateMethod; +} +extension /* unnamed */ _extension#4 on test::Class { // from org-dartlang-testcase:///patch_lib1.dart + method unnamedInjectedExtensionMethod1 = test::_extension#4|unnamedInjectedExtensionMethod1; + method tearoff unnamedInjectedExtensionMethod1 = test::_extension#4|get#unnamedInjectedExtensionMethod1; + method _unnamedInjectedExtensionPrivateMethod1 = test::_extension#4|_unnamedInjectedExtensionPrivateMethod1; + method tearoff _unnamedInjectedExtensionPrivateMethod1 = test::_extension#4|get#_unnamedInjectedExtensionPrivateMethod1; +} +extension /* unnamed */ _extension#5 on test::Class { // from org-dartlang-testcase:///patch_lib2.dart + method unnamedInjectedExtensionMethod2 = test::_extension#5|unnamedInjectedExtensionMethod2; + method tearoff unnamedInjectedExtensionMethod2 = test::_extension#5|get#unnamedInjectedExtensionMethod2; + method _unnamedInjectedExtensionPrivateMethod2 = test::_extension#5|_unnamedInjectedExtensionPrivateMethod2; + method tearoff _unnamedInjectedExtensionPrivateMethod2 = test::_extension#5|get#_unnamedInjectedExtensionPrivateMethod2; } static method _method(test::Class c) → void { test::Extension|namedExtensionMethod(c); test::Extension|_namedExtensionPrivateMethod(c); - test::_extension#5|unnamedExtensionMethod(c); - test::_extension#5|_unnamedExtensionPrivateMethod(c); + test::_extension#3|unnamedExtensionMethod(c); + test::_extension#3|_unnamedExtensionPrivateMethod(c); test::NamedInjectedExtension1|namedInjectedExtensionMethod1(c); test::NamedInjectedExtension1|_namedInjectedExtensionPrivateMethod1(c); - test::_extension#1|unnamedInjectedExtensionMethod1(c); - test::_extension#1|_unnamedInjectedExtensionPrivateMethod1(c); + test::_extension#4|unnamedInjectedExtensionMethod1(c); + test::_extension#4|_unnamedInjectedExtensionPrivateMethod1(c); test::NamedInjectedExtension2|namedInjectedExtensionMethod2(c); test::NamedInjectedExtension2|_namedInjectedExtensionPrivateMethod2(c); - test::_extension#3|unnamedInjectedExtensionMethod2(c); - test::_extension#3|_unnamedInjectedExtensionPrivateMethod2(c); + test::_extension#5|unnamedInjectedExtensionMethod2(c); + test::_extension#5|_unnamedInjectedExtensionPrivateMethod2(c); } static extension-member method Extension|namedExtensionMethod(lowered final test::Class #this) → void {} static extension-member method Extension|get#namedExtensionMethod(lowered final test::Class #this) → () → void @@ -243,25 +243,25 @@ static extension-member method Extension|get#namedExtensionMethod(lowered final static extension-member method Extension|_namedExtensionPrivateMethod(lowered final test::Class #this) → void {} static extension-member method Extension|get#_namedExtensionPrivateMethod(lowered final test::Class #this) → () → void return () → void => test::Extension|_namedExtensionPrivateMethod(#this); -static extension-member method _extension#5|unnamedExtensionMethod(lowered final test::Class #this) → void {} -static extension-member method _extension#5|get#unnamedExtensionMethod(lowered final test::Class #this) → () → void - return () → void => test::_extension#5|unnamedExtensionMethod(#this); -static extension-member method _extension#5|_unnamedExtensionPrivateMethod(lowered final test::Class #this) → void {} -static extension-member method _extension#5|get#_unnamedExtensionPrivateMethod(lowered final test::Class #this) → () → void - return () → void => test::_extension#5|_unnamedExtensionPrivateMethod(#this); +static extension-member method _extension#3|unnamedExtensionMethod(lowered final test::Class #this) → void {} +static extension-member method _extension#3|get#unnamedExtensionMethod(lowered final test::Class #this) → () → void + return () → void => test::_extension#3|unnamedExtensionMethod(#this); +static extension-member method _extension#3|_unnamedExtensionPrivateMethod(lowered final test::Class #this) → void {} +static extension-member method _extension#3|get#_unnamedExtensionPrivateMethod(lowered final test::Class #this) → () → void + return () → void => test::_extension#3|_unnamedExtensionPrivateMethod(#this); static method /* from org-dartlang-testcase:///patch_lib1.dart */ _method1(test::Class c) → void { test::Extension|namedExtensionMethod(c); test::Extension|_namedExtensionPrivateMethod(c); - test::_extension#5|unnamedExtensionMethod(c); - test::_extension#5|_unnamedExtensionPrivateMethod(c); + test::_extension#3|unnamedExtensionMethod(c); + test::_extension#3|_unnamedExtensionPrivateMethod(c); test::NamedInjectedExtension1|namedInjectedExtensionMethod1(c); test::NamedInjectedExtension1|_namedInjectedExtensionPrivateMethod1(c); - test::_extension#1|unnamedInjectedExtensionMethod1(c); - test::_extension#1|_unnamedInjectedExtensionPrivateMethod1(c); + test::_extension#4|unnamedInjectedExtensionMethod1(c); + test::_extension#4|_unnamedInjectedExtensionPrivateMethod1(c); test::NamedInjectedExtension2|namedInjectedExtensionMethod2(c); test::NamedInjectedExtension2|_namedInjectedExtensionPrivateMethod2(c); - test::_extension#3|unnamedInjectedExtensionMethod2(c); - test::_extension#3|_unnamedInjectedExtensionPrivateMethod2(c); + test::_extension#5|unnamedInjectedExtensionMethod2(c); + test::_extension#5|_unnamedInjectedExtensionPrivateMethod2(c); } static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ NamedInjectedExtension1|namedInjectedExtensionMethod1(lowered final test::Class #this) → void {} static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ NamedInjectedExtension1|get#namedInjectedExtensionMethod1(lowered final test::Class #this) → () → void @@ -269,25 +269,25 @@ static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ NamedInjectedExtension1|_namedInjectedExtensionPrivateMethod1(lowered final test::Class #this) → void {} static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ NamedInjectedExtension1|get#_namedInjectedExtensionPrivateMethod1(lowered final test::Class #this) → () → void return () → void => test::NamedInjectedExtension1|_namedInjectedExtensionPrivateMethod1(#this); -static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ _extension#1|unnamedInjectedExtensionMethod1(lowered final test::Class #this) → void {} -static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ _extension#1|get#unnamedInjectedExtensionMethod1(lowered final test::Class #this) → () → void - return () → void => test::_extension#1|unnamedInjectedExtensionMethod1(#this); -static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ _extension#1|_unnamedInjectedExtensionPrivateMethod1(lowered final test::Class #this) → void {} -static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ _extension#1|get#_unnamedInjectedExtensionPrivateMethod1(lowered final test::Class #this) → () → void - return () → void => test::_extension#1|_unnamedInjectedExtensionPrivateMethod1(#this); +static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ _extension#4|unnamedInjectedExtensionMethod1(lowered final test::Class #this) → void {} +static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ _extension#4|get#unnamedInjectedExtensionMethod1(lowered final test::Class #this) → () → void + return () → void => test::_extension#4|unnamedInjectedExtensionMethod1(#this); +static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ _extension#4|_unnamedInjectedExtensionPrivateMethod1(lowered final test::Class #this) → void {} +static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ _extension#4|get#_unnamedInjectedExtensionPrivateMethod1(lowered final test::Class #this) → () → void + return () → void => test::_extension#4|_unnamedInjectedExtensionPrivateMethod1(#this); static method /* from org-dartlang-testcase:///patch_lib2.dart */ _method2(test::Class c) → void { test::Extension|namedExtensionMethod(c); test::Extension|_namedExtensionPrivateMethod(c); - test::_extension#5|unnamedExtensionMethod(c); - test::_extension#5|_unnamedExtensionPrivateMethod(c); + test::_extension#3|unnamedExtensionMethod(c); + test::_extension#3|_unnamedExtensionPrivateMethod(c); test::NamedInjectedExtension1|namedInjectedExtensionMethod1(c); test::NamedInjectedExtension1|_namedInjectedExtensionPrivateMethod1(c); - test::_extension#1|unnamedInjectedExtensionMethod1(c); - test::_extension#1|_unnamedInjectedExtensionPrivateMethod1(c); + test::_extension#4|unnamedInjectedExtensionMethod1(c); + test::_extension#4|_unnamedInjectedExtensionPrivateMethod1(c); test::NamedInjectedExtension2|namedInjectedExtensionMethod2(c); test::NamedInjectedExtension2|_namedInjectedExtensionPrivateMethod2(c); - test::_extension#3|unnamedInjectedExtensionMethod2(c); - test::_extension#3|_unnamedInjectedExtensionPrivateMethod2(c); + test::_extension#5|unnamedInjectedExtensionMethod2(c); + test::_extension#5|_unnamedInjectedExtensionPrivateMethod2(c); } static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ NamedInjectedExtension2|namedInjectedExtensionMethod2(lowered final test::Class #this) → void {} static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ NamedInjectedExtension2|get#namedInjectedExtensionMethod2(lowered final test::Class #this) → () → void @@ -295,12 +295,12 @@ static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ NamedInjectedExtension2|_namedInjectedExtensionPrivateMethod2(lowered final test::Class #this) → void {} static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ NamedInjectedExtension2|get#_namedInjectedExtensionPrivateMethod2(lowered final test::Class #this) → () → void return () → void => test::NamedInjectedExtension2|_namedInjectedExtensionPrivateMethod2(#this); -static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ _extension#3|unnamedInjectedExtensionMethod2(lowered final test::Class #this) → void {} -static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ _extension#3|get#unnamedInjectedExtensionMethod2(lowered final test::Class #this) → () → void - return () → void => test::_extension#3|unnamedInjectedExtensionMethod2(#this); -static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ _extension#3|_unnamedInjectedExtensionPrivateMethod2(lowered final test::Class #this) → void {} -static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ _extension#3|get#_unnamedInjectedExtensionPrivateMethod2(lowered final test::Class #this) → () → void - return () → void => test::_extension#3|_unnamedInjectedExtensionPrivateMethod2(#this); +static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ _extension#5|unnamedInjectedExtensionMethod2(lowered final test::Class #this) → void {} +static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ _extension#5|get#unnamedInjectedExtensionMethod2(lowered final test::Class #this) → () → void + return () → void => test::_extension#5|unnamedInjectedExtensionMethod2(#this); +static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ _extension#5|_unnamedInjectedExtensionPrivateMethod2(lowered final test::Class #this) → void {} +static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ _extension#5|get#_unnamedInjectedExtensionPrivateMethod2(lowered final test::Class #this) → () → void + return () → void => test::_extension#5|_unnamedInjectedExtensionPrivateMethod2(#this); constants { #C1 = _in::_Patch {} diff --git a/pkg/front_end/testcases/general/patch_extension_scope/main.dart.strong.modular.expect b/pkg/front_end/testcases/general/patch_extension_scope/main.dart.strong.modular.expect index 2d098ecc70f..a8dc68c42db 100644 --- a/pkg/front_end/testcases/general/patch_extension_scope/main.dart.strong.modular.expect +++ b/pkg/front_end/testcases/general/patch_extension_scope/main.dart.strong.modular.expect @@ -147,95 +147,95 @@ class Class extends core::Object { method _method() → void { test::Extension|namedExtensionMethod(this); test::Extension|_namedExtensionPrivateMethod(this); - test::_extension#5|unnamedExtensionMethod(this); - test::_extension#5|_unnamedExtensionPrivateMethod(this); + test::_extension#3|unnamedExtensionMethod(this); + test::_extension#3|_unnamedExtensionPrivateMethod(this); test::NamedInjectedExtension1|namedInjectedExtensionMethod1(this); test::NamedInjectedExtension1|_namedInjectedExtensionPrivateMethod1(this); - test::_extension#1|unnamedInjectedExtensionMethod1(this); - test::_extension#1|_unnamedInjectedExtensionPrivateMethod1(this); + test::_extension#4|unnamedInjectedExtensionMethod1(this); + test::_extension#4|_unnamedInjectedExtensionPrivateMethod1(this); test::NamedInjectedExtension2|namedInjectedExtensionMethod2(this); test::NamedInjectedExtension2|_namedInjectedExtensionPrivateMethod2(this); - test::_extension#3|unnamedInjectedExtensionMethod2(this); - test::_extension#3|_unnamedInjectedExtensionPrivateMethod2(this); + test::_extension#5|unnamedInjectedExtensionMethod2(this); + test::_extension#5|_unnamedInjectedExtensionPrivateMethod2(this); } method /* from org-dartlang-testcase:///patch_lib1.dart */ _method1() → void { test::Extension|namedExtensionMethod(this); test::Extension|_namedExtensionPrivateMethod(this); - test::_extension#5|unnamedExtensionMethod(this); - test::_extension#5|_unnamedExtensionPrivateMethod(this); + test::_extension#3|unnamedExtensionMethod(this); + test::_extension#3|_unnamedExtensionPrivateMethod(this); test::NamedInjectedExtension1|namedInjectedExtensionMethod1(this); test::NamedInjectedExtension1|_namedInjectedExtensionPrivateMethod1(this); - test::_extension#1|unnamedInjectedExtensionMethod1(this); - test::_extension#1|_unnamedInjectedExtensionPrivateMethod1(this); + test::_extension#4|unnamedInjectedExtensionMethod1(this); + test::_extension#4|_unnamedInjectedExtensionPrivateMethod1(this); test::NamedInjectedExtension2|namedInjectedExtensionMethod2(this); test::NamedInjectedExtension2|_namedInjectedExtensionPrivateMethod2(this); - test::_extension#3|unnamedInjectedExtensionMethod2(this); - test::_extension#3|_unnamedInjectedExtensionPrivateMethod2(this); + test::_extension#5|unnamedInjectedExtensionMethod2(this); + test::_extension#5|_unnamedInjectedExtensionPrivateMethod2(this); } method /* from org-dartlang-testcase:///patch_lib2.dart */ _method2() → void { test::Extension|namedExtensionMethod(this); test::Extension|_namedExtensionPrivateMethod(this); - test::_extension#5|unnamedExtensionMethod(this); - test::_extension#5|_unnamedExtensionPrivateMethod(this); + test::_extension#3|unnamedExtensionMethod(this); + test::_extension#3|_unnamedExtensionPrivateMethod(this); test::NamedInjectedExtension1|namedInjectedExtensionMethod1(this); test::NamedInjectedExtension1|_namedInjectedExtensionPrivateMethod1(this); - test::_extension#1|unnamedInjectedExtensionMethod1(this); - test::_extension#1|_unnamedInjectedExtensionPrivateMethod1(this); + test::_extension#4|unnamedInjectedExtensionMethod1(this); + test::_extension#4|_unnamedInjectedExtensionPrivateMethod1(this); test::NamedInjectedExtension2|namedInjectedExtensionMethod2(this); test::NamedInjectedExtension2|_namedInjectedExtensionPrivateMethod2(this); - test::_extension#3|unnamedInjectedExtensionMethod2(this); - test::_extension#3|_unnamedInjectedExtensionPrivateMethod2(this); + test::_extension#5|unnamedInjectedExtensionMethod2(this); + test::_extension#5|_unnamedInjectedExtensionPrivateMethod2(this); } } -extension NamedInjectedExtension1 on test::Class { // from org-dartlang-testcase:///patch_lib1.dart - method namedInjectedExtensionMethod1 = test::NamedInjectedExtension1|namedInjectedExtensionMethod1; - method tearoff namedInjectedExtensionMethod1 = test::NamedInjectedExtension1|get#namedInjectedExtensionMethod1; - method _namedInjectedExtensionPrivateMethod1 = test::NamedInjectedExtension1|_namedInjectedExtensionPrivateMethod1; - method tearoff _namedInjectedExtensionPrivateMethod1 = test::NamedInjectedExtension1|get#_namedInjectedExtensionPrivateMethod1; -} -extension /* unnamed */ _extension#1 on test::Class { // from org-dartlang-testcase:///patch_lib1.dart - method unnamedInjectedExtensionMethod1 = test::_extension#1|unnamedInjectedExtensionMethod1; - method tearoff unnamedInjectedExtensionMethod1 = test::_extension#1|get#unnamedInjectedExtensionMethod1; - method _unnamedInjectedExtensionPrivateMethod1 = test::_extension#1|_unnamedInjectedExtensionPrivateMethod1; - method tearoff _unnamedInjectedExtensionPrivateMethod1 = test::_extension#1|get#_unnamedInjectedExtensionPrivateMethod1; -} -extension NamedInjectedExtension2 on test::Class { // from org-dartlang-testcase:///patch_lib2.dart - method namedInjectedExtensionMethod2 = test::NamedInjectedExtension2|namedInjectedExtensionMethod2; - method tearoff namedInjectedExtensionMethod2 = test::NamedInjectedExtension2|get#namedInjectedExtensionMethod2; - method _namedInjectedExtensionPrivateMethod2 = test::NamedInjectedExtension2|_namedInjectedExtensionPrivateMethod2; - method tearoff _namedInjectedExtensionPrivateMethod2 = test::NamedInjectedExtension2|get#_namedInjectedExtensionPrivateMethod2; -} -extension /* unnamed */ _extension#3 on test::Class { // from org-dartlang-testcase:///patch_lib2.dart - method unnamedInjectedExtensionMethod2 = test::_extension#3|unnamedInjectedExtensionMethod2; - method tearoff unnamedInjectedExtensionMethod2 = test::_extension#3|get#unnamedInjectedExtensionMethod2; - method _unnamedInjectedExtensionPrivateMethod2 = test::_extension#3|_unnamedInjectedExtensionPrivateMethod2; - method tearoff _unnamedInjectedExtensionPrivateMethod2 = test::_extension#3|get#_unnamedInjectedExtensionPrivateMethod2; -} extension Extension on test::Class { method namedExtensionMethod = test::Extension|namedExtensionMethod; method tearoff namedExtensionMethod = test::Extension|get#namedExtensionMethod; method _namedExtensionPrivateMethod = test::Extension|_namedExtensionPrivateMethod; method tearoff _namedExtensionPrivateMethod = test::Extension|get#_namedExtensionPrivateMethod; } -extension /* unnamed */ _extension#5 on test::Class { - method unnamedExtensionMethod = test::_extension#5|unnamedExtensionMethod; - method tearoff unnamedExtensionMethod = test::_extension#5|get#unnamedExtensionMethod; - method _unnamedExtensionPrivateMethod = test::_extension#5|_unnamedExtensionPrivateMethod; - method tearoff _unnamedExtensionPrivateMethod = test::_extension#5|get#_unnamedExtensionPrivateMethod; +extension NamedInjectedExtension1 on test::Class { // from org-dartlang-testcase:///patch_lib1.dart + method namedInjectedExtensionMethod1 = test::NamedInjectedExtension1|namedInjectedExtensionMethod1; + method tearoff namedInjectedExtensionMethod1 = test::NamedInjectedExtension1|get#namedInjectedExtensionMethod1; + method _namedInjectedExtensionPrivateMethod1 = test::NamedInjectedExtension1|_namedInjectedExtensionPrivateMethod1; + method tearoff _namedInjectedExtensionPrivateMethod1 = test::NamedInjectedExtension1|get#_namedInjectedExtensionPrivateMethod1; +} +extension NamedInjectedExtension2 on test::Class { // from org-dartlang-testcase:///patch_lib2.dart + method namedInjectedExtensionMethod2 = test::NamedInjectedExtension2|namedInjectedExtensionMethod2; + method tearoff namedInjectedExtensionMethod2 = test::NamedInjectedExtension2|get#namedInjectedExtensionMethod2; + method _namedInjectedExtensionPrivateMethod2 = test::NamedInjectedExtension2|_namedInjectedExtensionPrivateMethod2; + method tearoff _namedInjectedExtensionPrivateMethod2 = test::NamedInjectedExtension2|get#_namedInjectedExtensionPrivateMethod2; +} +extension /* unnamed */ _extension#3 on test::Class { + method unnamedExtensionMethod = test::_extension#3|unnamedExtensionMethod; + method tearoff unnamedExtensionMethod = test::_extension#3|get#unnamedExtensionMethod; + method _unnamedExtensionPrivateMethod = test::_extension#3|_unnamedExtensionPrivateMethod; + method tearoff _unnamedExtensionPrivateMethod = test::_extension#3|get#_unnamedExtensionPrivateMethod; +} +extension /* unnamed */ _extension#4 on test::Class { // from org-dartlang-testcase:///patch_lib1.dart + method unnamedInjectedExtensionMethod1 = test::_extension#4|unnamedInjectedExtensionMethod1; + method tearoff unnamedInjectedExtensionMethod1 = test::_extension#4|get#unnamedInjectedExtensionMethod1; + method _unnamedInjectedExtensionPrivateMethod1 = test::_extension#4|_unnamedInjectedExtensionPrivateMethod1; + method tearoff _unnamedInjectedExtensionPrivateMethod1 = test::_extension#4|get#_unnamedInjectedExtensionPrivateMethod1; +} +extension /* unnamed */ _extension#5 on test::Class { // from org-dartlang-testcase:///patch_lib2.dart + method unnamedInjectedExtensionMethod2 = test::_extension#5|unnamedInjectedExtensionMethod2; + method tearoff unnamedInjectedExtensionMethod2 = test::_extension#5|get#unnamedInjectedExtensionMethod2; + method _unnamedInjectedExtensionPrivateMethod2 = test::_extension#5|_unnamedInjectedExtensionPrivateMethod2; + method tearoff _unnamedInjectedExtensionPrivateMethod2 = test::_extension#5|get#_unnamedInjectedExtensionPrivateMethod2; } static method _method(test::Class c) → void { test::Extension|namedExtensionMethod(c); test::Extension|_namedExtensionPrivateMethod(c); - test::_extension#5|unnamedExtensionMethod(c); - test::_extension#5|_unnamedExtensionPrivateMethod(c); + test::_extension#3|unnamedExtensionMethod(c); + test::_extension#3|_unnamedExtensionPrivateMethod(c); test::NamedInjectedExtension1|namedInjectedExtensionMethod1(c); test::NamedInjectedExtension1|_namedInjectedExtensionPrivateMethod1(c); - test::_extension#1|unnamedInjectedExtensionMethod1(c); - test::_extension#1|_unnamedInjectedExtensionPrivateMethod1(c); + test::_extension#4|unnamedInjectedExtensionMethod1(c); + test::_extension#4|_unnamedInjectedExtensionPrivateMethod1(c); test::NamedInjectedExtension2|namedInjectedExtensionMethod2(c); test::NamedInjectedExtension2|_namedInjectedExtensionPrivateMethod2(c); - test::_extension#3|unnamedInjectedExtensionMethod2(c); - test::_extension#3|_unnamedInjectedExtensionPrivateMethod2(c); + test::_extension#5|unnamedInjectedExtensionMethod2(c); + test::_extension#5|_unnamedInjectedExtensionPrivateMethod2(c); } static extension-member method Extension|namedExtensionMethod(lowered final test::Class #this) → void {} static extension-member method Extension|get#namedExtensionMethod(lowered final test::Class #this) → () → void @@ -243,25 +243,25 @@ static extension-member method Extension|get#namedExtensionMethod(lowered final static extension-member method Extension|_namedExtensionPrivateMethod(lowered final test::Class #this) → void {} static extension-member method Extension|get#_namedExtensionPrivateMethod(lowered final test::Class #this) → () → void return () → void => test::Extension|_namedExtensionPrivateMethod(#this); -static extension-member method _extension#5|unnamedExtensionMethod(lowered final test::Class #this) → void {} -static extension-member method _extension#5|get#unnamedExtensionMethod(lowered final test::Class #this) → () → void - return () → void => test::_extension#5|unnamedExtensionMethod(#this); -static extension-member method _extension#5|_unnamedExtensionPrivateMethod(lowered final test::Class #this) → void {} -static extension-member method _extension#5|get#_unnamedExtensionPrivateMethod(lowered final test::Class #this) → () → void - return () → void => test::_extension#5|_unnamedExtensionPrivateMethod(#this); +static extension-member method _extension#3|unnamedExtensionMethod(lowered final test::Class #this) → void {} +static extension-member method _extension#3|get#unnamedExtensionMethod(lowered final test::Class #this) → () → void + return () → void => test::_extension#3|unnamedExtensionMethod(#this); +static extension-member method _extension#3|_unnamedExtensionPrivateMethod(lowered final test::Class #this) → void {} +static extension-member method _extension#3|get#_unnamedExtensionPrivateMethod(lowered final test::Class #this) → () → void + return () → void => test::_extension#3|_unnamedExtensionPrivateMethod(#this); static method /* from org-dartlang-testcase:///patch_lib1.dart */ _method1(test::Class c) → void { test::Extension|namedExtensionMethod(c); test::Extension|_namedExtensionPrivateMethod(c); - test::_extension#5|unnamedExtensionMethod(c); - test::_extension#5|_unnamedExtensionPrivateMethod(c); + test::_extension#3|unnamedExtensionMethod(c); + test::_extension#3|_unnamedExtensionPrivateMethod(c); test::NamedInjectedExtension1|namedInjectedExtensionMethod1(c); test::NamedInjectedExtension1|_namedInjectedExtensionPrivateMethod1(c); - test::_extension#1|unnamedInjectedExtensionMethod1(c); - test::_extension#1|_unnamedInjectedExtensionPrivateMethod1(c); + test::_extension#4|unnamedInjectedExtensionMethod1(c); + test::_extension#4|_unnamedInjectedExtensionPrivateMethod1(c); test::NamedInjectedExtension2|namedInjectedExtensionMethod2(c); test::NamedInjectedExtension2|_namedInjectedExtensionPrivateMethod2(c); - test::_extension#3|unnamedInjectedExtensionMethod2(c); - test::_extension#3|_unnamedInjectedExtensionPrivateMethod2(c); + test::_extension#5|unnamedInjectedExtensionMethod2(c); + test::_extension#5|_unnamedInjectedExtensionPrivateMethod2(c); } static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ NamedInjectedExtension1|namedInjectedExtensionMethod1(lowered final test::Class #this) → void {} static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ NamedInjectedExtension1|get#namedInjectedExtensionMethod1(lowered final test::Class #this) → () → void @@ -269,25 +269,25 @@ static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ NamedInjectedExtension1|_namedInjectedExtensionPrivateMethod1(lowered final test::Class #this) → void {} static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ NamedInjectedExtension1|get#_namedInjectedExtensionPrivateMethod1(lowered final test::Class #this) → () → void return () → void => test::NamedInjectedExtension1|_namedInjectedExtensionPrivateMethod1(#this); -static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ _extension#1|unnamedInjectedExtensionMethod1(lowered final test::Class #this) → void {} -static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ _extension#1|get#unnamedInjectedExtensionMethod1(lowered final test::Class #this) → () → void - return () → void => test::_extension#1|unnamedInjectedExtensionMethod1(#this); -static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ _extension#1|_unnamedInjectedExtensionPrivateMethod1(lowered final test::Class #this) → void {} -static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ _extension#1|get#_unnamedInjectedExtensionPrivateMethod1(lowered final test::Class #this) → () → void - return () → void => test::_extension#1|_unnamedInjectedExtensionPrivateMethod1(#this); +static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ _extension#4|unnamedInjectedExtensionMethod1(lowered final test::Class #this) → void {} +static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ _extension#4|get#unnamedInjectedExtensionMethod1(lowered final test::Class #this) → () → void + return () → void => test::_extension#4|unnamedInjectedExtensionMethod1(#this); +static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ _extension#4|_unnamedInjectedExtensionPrivateMethod1(lowered final test::Class #this) → void {} +static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ _extension#4|get#_unnamedInjectedExtensionPrivateMethod1(lowered final test::Class #this) → () → void + return () → void => test::_extension#4|_unnamedInjectedExtensionPrivateMethod1(#this); static method /* from org-dartlang-testcase:///patch_lib2.dart */ _method2(test::Class c) → void { test::Extension|namedExtensionMethod(c); test::Extension|_namedExtensionPrivateMethod(c); - test::_extension#5|unnamedExtensionMethod(c); - test::_extension#5|_unnamedExtensionPrivateMethod(c); + test::_extension#3|unnamedExtensionMethod(c); + test::_extension#3|_unnamedExtensionPrivateMethod(c); test::NamedInjectedExtension1|namedInjectedExtensionMethod1(c); test::NamedInjectedExtension1|_namedInjectedExtensionPrivateMethod1(c); - test::_extension#1|unnamedInjectedExtensionMethod1(c); - test::_extension#1|_unnamedInjectedExtensionPrivateMethod1(c); + test::_extension#4|unnamedInjectedExtensionMethod1(c); + test::_extension#4|_unnamedInjectedExtensionPrivateMethod1(c); test::NamedInjectedExtension2|namedInjectedExtensionMethod2(c); test::NamedInjectedExtension2|_namedInjectedExtensionPrivateMethod2(c); - test::_extension#3|unnamedInjectedExtensionMethod2(c); - test::_extension#3|_unnamedInjectedExtensionPrivateMethod2(c); + test::_extension#5|unnamedInjectedExtensionMethod2(c); + test::_extension#5|_unnamedInjectedExtensionPrivateMethod2(c); } static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ NamedInjectedExtension2|namedInjectedExtensionMethod2(lowered final test::Class #this) → void {} static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ NamedInjectedExtension2|get#namedInjectedExtensionMethod2(lowered final test::Class #this) → () → void @@ -295,12 +295,12 @@ static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ NamedInjectedExtension2|_namedInjectedExtensionPrivateMethod2(lowered final test::Class #this) → void {} static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ NamedInjectedExtension2|get#_namedInjectedExtensionPrivateMethod2(lowered final test::Class #this) → () → void return () → void => test::NamedInjectedExtension2|_namedInjectedExtensionPrivateMethod2(#this); -static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ _extension#3|unnamedInjectedExtensionMethod2(lowered final test::Class #this) → void {} -static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ _extension#3|get#unnamedInjectedExtensionMethod2(lowered final test::Class #this) → () → void - return () → void => test::_extension#3|unnamedInjectedExtensionMethod2(#this); -static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ _extension#3|_unnamedInjectedExtensionPrivateMethod2(lowered final test::Class #this) → void {} -static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ _extension#3|get#_unnamedInjectedExtensionPrivateMethod2(lowered final test::Class #this) → () → void - return () → void => test::_extension#3|_unnamedInjectedExtensionPrivateMethod2(#this); +static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ _extension#5|unnamedInjectedExtensionMethod2(lowered final test::Class #this) → void {} +static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ _extension#5|get#unnamedInjectedExtensionMethod2(lowered final test::Class #this) → () → void + return () → void => test::_extension#5|unnamedInjectedExtensionMethod2(#this); +static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ _extension#5|_unnamedInjectedExtensionPrivateMethod2(lowered final test::Class #this) → void {} +static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ _extension#5|get#_unnamedInjectedExtensionPrivateMethod2(lowered final test::Class #this) → () → void + return () → void => test::_extension#5|_unnamedInjectedExtensionPrivateMethod2(#this); constants { #C1 = _in::_Patch {} diff --git a/pkg/front_end/testcases/general/patch_extension_scope/main.dart.strong.outline.expect b/pkg/front_end/testcases/general/patch_extension_scope/main.dart.strong.outline.expect index 22bb92a1b90..c62940e76e9 100644 --- a/pkg/front_end/testcases/general/patch_extension_scope/main.dart.strong.outline.expect +++ b/pkg/front_end/testcases/general/patch_extension_scope/main.dart.strong.outline.expect @@ -44,41 +44,41 @@ class Class extends core::Object { method /* from org-dartlang-testcase:///patch_lib2.dart */ _method2() → void ; } +extension Extension on test::Class { + method namedExtensionMethod = test::Extension|namedExtensionMethod; + method tearoff namedExtensionMethod = test::Extension|get#namedExtensionMethod; + method _namedExtensionPrivateMethod = test::Extension|_namedExtensionPrivateMethod; + method tearoff _namedExtensionPrivateMethod = test::Extension|get#_namedExtensionPrivateMethod; +} extension NamedInjectedExtension1 on test::Class { // from org-dartlang-testcase:///patch_lib1.dart method namedInjectedExtensionMethod1 = test::NamedInjectedExtension1|namedInjectedExtensionMethod1; method tearoff namedInjectedExtensionMethod1 = test::NamedInjectedExtension1|get#namedInjectedExtensionMethod1; method _namedInjectedExtensionPrivateMethod1 = test::NamedInjectedExtension1|_namedInjectedExtensionPrivateMethod1; method tearoff _namedInjectedExtensionPrivateMethod1 = test::NamedInjectedExtension1|get#_namedInjectedExtensionPrivateMethod1; } -extension /* unnamed */ _extension#1 on test::Class { // from org-dartlang-testcase:///patch_lib1.dart - method unnamedInjectedExtensionMethod1 = test::_extension#1|unnamedInjectedExtensionMethod1; - method tearoff unnamedInjectedExtensionMethod1 = test::_extension#1|get#unnamedInjectedExtensionMethod1; - method _unnamedInjectedExtensionPrivateMethod1 = test::_extension#1|_unnamedInjectedExtensionPrivateMethod1; - method tearoff _unnamedInjectedExtensionPrivateMethod1 = test::_extension#1|get#_unnamedInjectedExtensionPrivateMethod1; -} extension NamedInjectedExtension2 on test::Class { // from org-dartlang-testcase:///patch_lib2.dart method namedInjectedExtensionMethod2 = test::NamedInjectedExtension2|namedInjectedExtensionMethod2; method tearoff namedInjectedExtensionMethod2 = test::NamedInjectedExtension2|get#namedInjectedExtensionMethod2; method _namedInjectedExtensionPrivateMethod2 = test::NamedInjectedExtension2|_namedInjectedExtensionPrivateMethod2; method tearoff _namedInjectedExtensionPrivateMethod2 = test::NamedInjectedExtension2|get#_namedInjectedExtensionPrivateMethod2; } -extension /* unnamed */ _extension#3 on test::Class { // from org-dartlang-testcase:///patch_lib2.dart - method unnamedInjectedExtensionMethod2 = test::_extension#3|unnamedInjectedExtensionMethod2; - method tearoff unnamedInjectedExtensionMethod2 = test::_extension#3|get#unnamedInjectedExtensionMethod2; - method _unnamedInjectedExtensionPrivateMethod2 = test::_extension#3|_unnamedInjectedExtensionPrivateMethod2; - method tearoff _unnamedInjectedExtensionPrivateMethod2 = test::_extension#3|get#_unnamedInjectedExtensionPrivateMethod2; +extension /* unnamed */ _extension#3 on test::Class { + method unnamedExtensionMethod = test::_extension#3|unnamedExtensionMethod; + method tearoff unnamedExtensionMethod = test::_extension#3|get#unnamedExtensionMethod; + method _unnamedExtensionPrivateMethod = test::_extension#3|_unnamedExtensionPrivateMethod; + method tearoff _unnamedExtensionPrivateMethod = test::_extension#3|get#_unnamedExtensionPrivateMethod; } -extension Extension on test::Class { - method namedExtensionMethod = test::Extension|namedExtensionMethod; - method tearoff namedExtensionMethod = test::Extension|get#namedExtensionMethod; - method _namedExtensionPrivateMethod = test::Extension|_namedExtensionPrivateMethod; - method tearoff _namedExtensionPrivateMethod = test::Extension|get#_namedExtensionPrivateMethod; +extension /* unnamed */ _extension#4 on test::Class { // from org-dartlang-testcase:///patch_lib1.dart + method unnamedInjectedExtensionMethod1 = test::_extension#4|unnamedInjectedExtensionMethod1; + method tearoff unnamedInjectedExtensionMethod1 = test::_extension#4|get#unnamedInjectedExtensionMethod1; + method _unnamedInjectedExtensionPrivateMethod1 = test::_extension#4|_unnamedInjectedExtensionPrivateMethod1; + method tearoff _unnamedInjectedExtensionPrivateMethod1 = test::_extension#4|get#_unnamedInjectedExtensionPrivateMethod1; } -extension /* unnamed */ _extension#5 on test::Class { - method unnamedExtensionMethod = test::_extension#5|unnamedExtensionMethod; - method tearoff unnamedExtensionMethod = test::_extension#5|get#unnamedExtensionMethod; - method _unnamedExtensionPrivateMethod = test::_extension#5|_unnamedExtensionPrivateMethod; - method tearoff _unnamedExtensionPrivateMethod = test::_extension#5|get#_unnamedExtensionPrivateMethod; +extension /* unnamed */ _extension#5 on test::Class { // from org-dartlang-testcase:///patch_lib2.dart + method unnamedInjectedExtensionMethod2 = test::_extension#5|unnamedInjectedExtensionMethod2; + method tearoff unnamedInjectedExtensionMethod2 = test::_extension#5|get#unnamedInjectedExtensionMethod2; + method _unnamedInjectedExtensionPrivateMethod2 = test::_extension#5|_unnamedInjectedExtensionPrivateMethod2; + method tearoff _unnamedInjectedExtensionPrivateMethod2 = test::_extension#5|get#_unnamedInjectedExtensionPrivateMethod2; } static method _method(test::Class c) → void ; @@ -90,14 +90,14 @@ static extension-member method Extension|_namedExtensionPrivateMethod(lowered fi ; static extension-member method Extension|get#_namedExtensionPrivateMethod(lowered final test::Class #this) → () → void return () → void => test::Extension|_namedExtensionPrivateMethod(#this); -static extension-member method _extension#5|unnamedExtensionMethod(lowered final test::Class #this) → void +static extension-member method _extension#3|unnamedExtensionMethod(lowered final test::Class #this) → void ; -static extension-member method _extension#5|get#unnamedExtensionMethod(lowered final test::Class #this) → () → void - return () → void => test::_extension#5|unnamedExtensionMethod(#this); -static extension-member method _extension#5|_unnamedExtensionPrivateMethod(lowered final test::Class #this) → void +static extension-member method _extension#3|get#unnamedExtensionMethod(lowered final test::Class #this) → () → void + return () → void => test::_extension#3|unnamedExtensionMethod(#this); +static extension-member method _extension#3|_unnamedExtensionPrivateMethod(lowered final test::Class #this) → void ; -static extension-member method _extension#5|get#_unnamedExtensionPrivateMethod(lowered final test::Class #this) → () → void - return () → void => test::_extension#5|_unnamedExtensionPrivateMethod(#this); +static extension-member method _extension#3|get#_unnamedExtensionPrivateMethod(lowered final test::Class #this) → () → void + return () → void => test::_extension#3|_unnamedExtensionPrivateMethod(#this); static method /* from org-dartlang-testcase:///patch_lib1.dart */ _method1(test::Class c) → void ; static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ NamedInjectedExtension1|namedInjectedExtensionMethod1(lowered final test::Class #this) → void @@ -108,14 +108,14 @@ static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart ; static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ NamedInjectedExtension1|get#_namedInjectedExtensionPrivateMethod1(lowered final test::Class #this) → () → void return () → void => test::NamedInjectedExtension1|_namedInjectedExtensionPrivateMethod1(#this); -static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ _extension#1|unnamedInjectedExtensionMethod1(lowered final test::Class #this) → void +static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ _extension#4|unnamedInjectedExtensionMethod1(lowered final test::Class #this) → void ; -static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ _extension#1|get#unnamedInjectedExtensionMethod1(lowered final test::Class #this) → () → void - return () → void => test::_extension#1|unnamedInjectedExtensionMethod1(#this); -static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ _extension#1|_unnamedInjectedExtensionPrivateMethod1(lowered final test::Class #this) → void +static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ _extension#4|get#unnamedInjectedExtensionMethod1(lowered final test::Class #this) → () → void + return () → void => test::_extension#4|unnamedInjectedExtensionMethod1(#this); +static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ _extension#4|_unnamedInjectedExtensionPrivateMethod1(lowered final test::Class #this) → void ; -static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ _extension#1|get#_unnamedInjectedExtensionPrivateMethod1(lowered final test::Class #this) → () → void - return () → void => test::_extension#1|_unnamedInjectedExtensionPrivateMethod1(#this); +static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ _extension#4|get#_unnamedInjectedExtensionPrivateMethod1(lowered final test::Class #this) → () → void + return () → void => test::_extension#4|_unnamedInjectedExtensionPrivateMethod1(#this); static method /* from org-dartlang-testcase:///patch_lib2.dart */ _method2(test::Class c) → void ; static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ NamedInjectedExtension2|namedInjectedExtensionMethod2(lowered final test::Class #this) → void @@ -126,14 +126,14 @@ static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart ; static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ NamedInjectedExtension2|get#_namedInjectedExtensionPrivateMethod2(lowered final test::Class #this) → () → void return () → void => test::NamedInjectedExtension2|_namedInjectedExtensionPrivateMethod2(#this); -static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ _extension#3|unnamedInjectedExtensionMethod2(lowered final test::Class #this) → void +static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ _extension#5|unnamedInjectedExtensionMethod2(lowered final test::Class #this) → void ; -static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ _extension#3|get#unnamedInjectedExtensionMethod2(lowered final test::Class #this) → () → void - return () → void => test::_extension#3|unnamedInjectedExtensionMethod2(#this); -static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ _extension#3|_unnamedInjectedExtensionPrivateMethod2(lowered final test::Class #this) → void +static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ _extension#5|get#unnamedInjectedExtensionMethod2(lowered final test::Class #this) → () → void + return () → void => test::_extension#5|unnamedInjectedExtensionMethod2(#this); +static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ _extension#5|_unnamedInjectedExtensionPrivateMethod2(lowered final test::Class #this) → void ; -static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ _extension#3|get#_unnamedInjectedExtensionPrivateMethod2(lowered final test::Class #this) → () → void - return () → void => test::_extension#3|_unnamedInjectedExtensionPrivateMethod2(#this); +static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ _extension#5|get#_unnamedInjectedExtensionPrivateMethod2(lowered final test::Class #this) → () → void + return () → void => test::_extension#5|_unnamedInjectedExtensionPrivateMethod2(#this); Extra constant evaluation status: diff --git a/pkg/front_end/testcases/general/patch_extension_scope/main.dart.strong.transformed.expect b/pkg/front_end/testcases/general/patch_extension_scope/main.dart.strong.transformed.expect index 2d098ecc70f..a8dc68c42db 100644 --- a/pkg/front_end/testcases/general/patch_extension_scope/main.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/general/patch_extension_scope/main.dart.strong.transformed.expect @@ -147,95 +147,95 @@ class Class extends core::Object { method _method() → void { test::Extension|namedExtensionMethod(this); test::Extension|_namedExtensionPrivateMethod(this); - test::_extension#5|unnamedExtensionMethod(this); - test::_extension#5|_unnamedExtensionPrivateMethod(this); + test::_extension#3|unnamedExtensionMethod(this); + test::_extension#3|_unnamedExtensionPrivateMethod(this); test::NamedInjectedExtension1|namedInjectedExtensionMethod1(this); test::NamedInjectedExtension1|_namedInjectedExtensionPrivateMethod1(this); - test::_extension#1|unnamedInjectedExtensionMethod1(this); - test::_extension#1|_unnamedInjectedExtensionPrivateMethod1(this); + test::_extension#4|unnamedInjectedExtensionMethod1(this); + test::_extension#4|_unnamedInjectedExtensionPrivateMethod1(this); test::NamedInjectedExtension2|namedInjectedExtensionMethod2(this); test::NamedInjectedExtension2|_namedInjectedExtensionPrivateMethod2(this); - test::_extension#3|unnamedInjectedExtensionMethod2(this); - test::_extension#3|_unnamedInjectedExtensionPrivateMethod2(this); + test::_extension#5|unnamedInjectedExtensionMethod2(this); + test::_extension#5|_unnamedInjectedExtensionPrivateMethod2(this); } method /* from org-dartlang-testcase:///patch_lib1.dart */ _method1() → void { test::Extension|namedExtensionMethod(this); test::Extension|_namedExtensionPrivateMethod(this); - test::_extension#5|unnamedExtensionMethod(this); - test::_extension#5|_unnamedExtensionPrivateMethod(this); + test::_extension#3|unnamedExtensionMethod(this); + test::_extension#3|_unnamedExtensionPrivateMethod(this); test::NamedInjectedExtension1|namedInjectedExtensionMethod1(this); test::NamedInjectedExtension1|_namedInjectedExtensionPrivateMethod1(this); - test::_extension#1|unnamedInjectedExtensionMethod1(this); - test::_extension#1|_unnamedInjectedExtensionPrivateMethod1(this); + test::_extension#4|unnamedInjectedExtensionMethod1(this); + test::_extension#4|_unnamedInjectedExtensionPrivateMethod1(this); test::NamedInjectedExtension2|namedInjectedExtensionMethod2(this); test::NamedInjectedExtension2|_namedInjectedExtensionPrivateMethod2(this); - test::_extension#3|unnamedInjectedExtensionMethod2(this); - test::_extension#3|_unnamedInjectedExtensionPrivateMethod2(this); + test::_extension#5|unnamedInjectedExtensionMethod2(this); + test::_extension#5|_unnamedInjectedExtensionPrivateMethod2(this); } method /* from org-dartlang-testcase:///patch_lib2.dart */ _method2() → void { test::Extension|namedExtensionMethod(this); test::Extension|_namedExtensionPrivateMethod(this); - test::_extension#5|unnamedExtensionMethod(this); - test::_extension#5|_unnamedExtensionPrivateMethod(this); + test::_extension#3|unnamedExtensionMethod(this); + test::_extension#3|_unnamedExtensionPrivateMethod(this); test::NamedInjectedExtension1|namedInjectedExtensionMethod1(this); test::NamedInjectedExtension1|_namedInjectedExtensionPrivateMethod1(this); - test::_extension#1|unnamedInjectedExtensionMethod1(this); - test::_extension#1|_unnamedInjectedExtensionPrivateMethod1(this); + test::_extension#4|unnamedInjectedExtensionMethod1(this); + test::_extension#4|_unnamedInjectedExtensionPrivateMethod1(this); test::NamedInjectedExtension2|namedInjectedExtensionMethod2(this); test::NamedInjectedExtension2|_namedInjectedExtensionPrivateMethod2(this); - test::_extension#3|unnamedInjectedExtensionMethod2(this); - test::_extension#3|_unnamedInjectedExtensionPrivateMethod2(this); + test::_extension#5|unnamedInjectedExtensionMethod2(this); + test::_extension#5|_unnamedInjectedExtensionPrivateMethod2(this); } } -extension NamedInjectedExtension1 on test::Class { // from org-dartlang-testcase:///patch_lib1.dart - method namedInjectedExtensionMethod1 = test::NamedInjectedExtension1|namedInjectedExtensionMethod1; - method tearoff namedInjectedExtensionMethod1 = test::NamedInjectedExtension1|get#namedInjectedExtensionMethod1; - method _namedInjectedExtensionPrivateMethod1 = test::NamedInjectedExtension1|_namedInjectedExtensionPrivateMethod1; - method tearoff _namedInjectedExtensionPrivateMethod1 = test::NamedInjectedExtension1|get#_namedInjectedExtensionPrivateMethod1; -} -extension /* unnamed */ _extension#1 on test::Class { // from org-dartlang-testcase:///patch_lib1.dart - method unnamedInjectedExtensionMethod1 = test::_extension#1|unnamedInjectedExtensionMethod1; - method tearoff unnamedInjectedExtensionMethod1 = test::_extension#1|get#unnamedInjectedExtensionMethod1; - method _unnamedInjectedExtensionPrivateMethod1 = test::_extension#1|_unnamedInjectedExtensionPrivateMethod1; - method tearoff _unnamedInjectedExtensionPrivateMethod1 = test::_extension#1|get#_unnamedInjectedExtensionPrivateMethod1; -} -extension NamedInjectedExtension2 on test::Class { // from org-dartlang-testcase:///patch_lib2.dart - method namedInjectedExtensionMethod2 = test::NamedInjectedExtension2|namedInjectedExtensionMethod2; - method tearoff namedInjectedExtensionMethod2 = test::NamedInjectedExtension2|get#namedInjectedExtensionMethod2; - method _namedInjectedExtensionPrivateMethod2 = test::NamedInjectedExtension2|_namedInjectedExtensionPrivateMethod2; - method tearoff _namedInjectedExtensionPrivateMethod2 = test::NamedInjectedExtension2|get#_namedInjectedExtensionPrivateMethod2; -} -extension /* unnamed */ _extension#3 on test::Class { // from org-dartlang-testcase:///patch_lib2.dart - method unnamedInjectedExtensionMethod2 = test::_extension#3|unnamedInjectedExtensionMethod2; - method tearoff unnamedInjectedExtensionMethod2 = test::_extension#3|get#unnamedInjectedExtensionMethod2; - method _unnamedInjectedExtensionPrivateMethod2 = test::_extension#3|_unnamedInjectedExtensionPrivateMethod2; - method tearoff _unnamedInjectedExtensionPrivateMethod2 = test::_extension#3|get#_unnamedInjectedExtensionPrivateMethod2; -} extension Extension on test::Class { method namedExtensionMethod = test::Extension|namedExtensionMethod; method tearoff namedExtensionMethod = test::Extension|get#namedExtensionMethod; method _namedExtensionPrivateMethod = test::Extension|_namedExtensionPrivateMethod; method tearoff _namedExtensionPrivateMethod = test::Extension|get#_namedExtensionPrivateMethod; } -extension /* unnamed */ _extension#5 on test::Class { - method unnamedExtensionMethod = test::_extension#5|unnamedExtensionMethod; - method tearoff unnamedExtensionMethod = test::_extension#5|get#unnamedExtensionMethod; - method _unnamedExtensionPrivateMethod = test::_extension#5|_unnamedExtensionPrivateMethod; - method tearoff _unnamedExtensionPrivateMethod = test::_extension#5|get#_unnamedExtensionPrivateMethod; +extension NamedInjectedExtension1 on test::Class { // from org-dartlang-testcase:///patch_lib1.dart + method namedInjectedExtensionMethod1 = test::NamedInjectedExtension1|namedInjectedExtensionMethod1; + method tearoff namedInjectedExtensionMethod1 = test::NamedInjectedExtension1|get#namedInjectedExtensionMethod1; + method _namedInjectedExtensionPrivateMethod1 = test::NamedInjectedExtension1|_namedInjectedExtensionPrivateMethod1; + method tearoff _namedInjectedExtensionPrivateMethod1 = test::NamedInjectedExtension1|get#_namedInjectedExtensionPrivateMethod1; +} +extension NamedInjectedExtension2 on test::Class { // from org-dartlang-testcase:///patch_lib2.dart + method namedInjectedExtensionMethod2 = test::NamedInjectedExtension2|namedInjectedExtensionMethod2; + method tearoff namedInjectedExtensionMethod2 = test::NamedInjectedExtension2|get#namedInjectedExtensionMethod2; + method _namedInjectedExtensionPrivateMethod2 = test::NamedInjectedExtension2|_namedInjectedExtensionPrivateMethod2; + method tearoff _namedInjectedExtensionPrivateMethod2 = test::NamedInjectedExtension2|get#_namedInjectedExtensionPrivateMethod2; +} +extension /* unnamed */ _extension#3 on test::Class { + method unnamedExtensionMethod = test::_extension#3|unnamedExtensionMethod; + method tearoff unnamedExtensionMethod = test::_extension#3|get#unnamedExtensionMethod; + method _unnamedExtensionPrivateMethod = test::_extension#3|_unnamedExtensionPrivateMethod; + method tearoff _unnamedExtensionPrivateMethod = test::_extension#3|get#_unnamedExtensionPrivateMethod; +} +extension /* unnamed */ _extension#4 on test::Class { // from org-dartlang-testcase:///patch_lib1.dart + method unnamedInjectedExtensionMethod1 = test::_extension#4|unnamedInjectedExtensionMethod1; + method tearoff unnamedInjectedExtensionMethod1 = test::_extension#4|get#unnamedInjectedExtensionMethod1; + method _unnamedInjectedExtensionPrivateMethod1 = test::_extension#4|_unnamedInjectedExtensionPrivateMethod1; + method tearoff _unnamedInjectedExtensionPrivateMethod1 = test::_extension#4|get#_unnamedInjectedExtensionPrivateMethod1; +} +extension /* unnamed */ _extension#5 on test::Class { // from org-dartlang-testcase:///patch_lib2.dart + method unnamedInjectedExtensionMethod2 = test::_extension#5|unnamedInjectedExtensionMethod2; + method tearoff unnamedInjectedExtensionMethod2 = test::_extension#5|get#unnamedInjectedExtensionMethod2; + method _unnamedInjectedExtensionPrivateMethod2 = test::_extension#5|_unnamedInjectedExtensionPrivateMethod2; + method tearoff _unnamedInjectedExtensionPrivateMethod2 = test::_extension#5|get#_unnamedInjectedExtensionPrivateMethod2; } static method _method(test::Class c) → void { test::Extension|namedExtensionMethod(c); test::Extension|_namedExtensionPrivateMethod(c); - test::_extension#5|unnamedExtensionMethod(c); - test::_extension#5|_unnamedExtensionPrivateMethod(c); + test::_extension#3|unnamedExtensionMethod(c); + test::_extension#3|_unnamedExtensionPrivateMethod(c); test::NamedInjectedExtension1|namedInjectedExtensionMethod1(c); test::NamedInjectedExtension1|_namedInjectedExtensionPrivateMethod1(c); - test::_extension#1|unnamedInjectedExtensionMethod1(c); - test::_extension#1|_unnamedInjectedExtensionPrivateMethod1(c); + test::_extension#4|unnamedInjectedExtensionMethod1(c); + test::_extension#4|_unnamedInjectedExtensionPrivateMethod1(c); test::NamedInjectedExtension2|namedInjectedExtensionMethod2(c); test::NamedInjectedExtension2|_namedInjectedExtensionPrivateMethod2(c); - test::_extension#3|unnamedInjectedExtensionMethod2(c); - test::_extension#3|_unnamedInjectedExtensionPrivateMethod2(c); + test::_extension#5|unnamedInjectedExtensionMethod2(c); + test::_extension#5|_unnamedInjectedExtensionPrivateMethod2(c); } static extension-member method Extension|namedExtensionMethod(lowered final test::Class #this) → void {} static extension-member method Extension|get#namedExtensionMethod(lowered final test::Class #this) → () → void @@ -243,25 +243,25 @@ static extension-member method Extension|get#namedExtensionMethod(lowered final static extension-member method Extension|_namedExtensionPrivateMethod(lowered final test::Class #this) → void {} static extension-member method Extension|get#_namedExtensionPrivateMethod(lowered final test::Class #this) → () → void return () → void => test::Extension|_namedExtensionPrivateMethod(#this); -static extension-member method _extension#5|unnamedExtensionMethod(lowered final test::Class #this) → void {} -static extension-member method _extension#5|get#unnamedExtensionMethod(lowered final test::Class #this) → () → void - return () → void => test::_extension#5|unnamedExtensionMethod(#this); -static extension-member method _extension#5|_unnamedExtensionPrivateMethod(lowered final test::Class #this) → void {} -static extension-member method _extension#5|get#_unnamedExtensionPrivateMethod(lowered final test::Class #this) → () → void - return () → void => test::_extension#5|_unnamedExtensionPrivateMethod(#this); +static extension-member method _extension#3|unnamedExtensionMethod(lowered final test::Class #this) → void {} +static extension-member method _extension#3|get#unnamedExtensionMethod(lowered final test::Class #this) → () → void + return () → void => test::_extension#3|unnamedExtensionMethod(#this); +static extension-member method _extension#3|_unnamedExtensionPrivateMethod(lowered final test::Class #this) → void {} +static extension-member method _extension#3|get#_unnamedExtensionPrivateMethod(lowered final test::Class #this) → () → void + return () → void => test::_extension#3|_unnamedExtensionPrivateMethod(#this); static method /* from org-dartlang-testcase:///patch_lib1.dart */ _method1(test::Class c) → void { test::Extension|namedExtensionMethod(c); test::Extension|_namedExtensionPrivateMethod(c); - test::_extension#5|unnamedExtensionMethod(c); - test::_extension#5|_unnamedExtensionPrivateMethod(c); + test::_extension#3|unnamedExtensionMethod(c); + test::_extension#3|_unnamedExtensionPrivateMethod(c); test::NamedInjectedExtension1|namedInjectedExtensionMethod1(c); test::NamedInjectedExtension1|_namedInjectedExtensionPrivateMethod1(c); - test::_extension#1|unnamedInjectedExtensionMethod1(c); - test::_extension#1|_unnamedInjectedExtensionPrivateMethod1(c); + test::_extension#4|unnamedInjectedExtensionMethod1(c); + test::_extension#4|_unnamedInjectedExtensionPrivateMethod1(c); test::NamedInjectedExtension2|namedInjectedExtensionMethod2(c); test::NamedInjectedExtension2|_namedInjectedExtensionPrivateMethod2(c); - test::_extension#3|unnamedInjectedExtensionMethod2(c); - test::_extension#3|_unnamedInjectedExtensionPrivateMethod2(c); + test::_extension#5|unnamedInjectedExtensionMethod2(c); + test::_extension#5|_unnamedInjectedExtensionPrivateMethod2(c); } static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ NamedInjectedExtension1|namedInjectedExtensionMethod1(lowered final test::Class #this) → void {} static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ NamedInjectedExtension1|get#namedInjectedExtensionMethod1(lowered final test::Class #this) → () → void @@ -269,25 +269,25 @@ static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ NamedInjectedExtension1|_namedInjectedExtensionPrivateMethod1(lowered final test::Class #this) → void {} static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ NamedInjectedExtension1|get#_namedInjectedExtensionPrivateMethod1(lowered final test::Class #this) → () → void return () → void => test::NamedInjectedExtension1|_namedInjectedExtensionPrivateMethod1(#this); -static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ _extension#1|unnamedInjectedExtensionMethod1(lowered final test::Class #this) → void {} -static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ _extension#1|get#unnamedInjectedExtensionMethod1(lowered final test::Class #this) → () → void - return () → void => test::_extension#1|unnamedInjectedExtensionMethod1(#this); -static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ _extension#1|_unnamedInjectedExtensionPrivateMethod1(lowered final test::Class #this) → void {} -static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ _extension#1|get#_unnamedInjectedExtensionPrivateMethod1(lowered final test::Class #this) → () → void - return () → void => test::_extension#1|_unnamedInjectedExtensionPrivateMethod1(#this); +static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ _extension#4|unnamedInjectedExtensionMethod1(lowered final test::Class #this) → void {} +static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ _extension#4|get#unnamedInjectedExtensionMethod1(lowered final test::Class #this) → () → void + return () → void => test::_extension#4|unnamedInjectedExtensionMethod1(#this); +static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ _extension#4|_unnamedInjectedExtensionPrivateMethod1(lowered final test::Class #this) → void {} +static extension-member method /* from org-dartlang-testcase:///patch_lib1.dart */ _extension#4|get#_unnamedInjectedExtensionPrivateMethod1(lowered final test::Class #this) → () → void + return () → void => test::_extension#4|_unnamedInjectedExtensionPrivateMethod1(#this); static method /* from org-dartlang-testcase:///patch_lib2.dart */ _method2(test::Class c) → void { test::Extension|namedExtensionMethod(c); test::Extension|_namedExtensionPrivateMethod(c); - test::_extension#5|unnamedExtensionMethod(c); - test::_extension#5|_unnamedExtensionPrivateMethod(c); + test::_extension#3|unnamedExtensionMethod(c); + test::_extension#3|_unnamedExtensionPrivateMethod(c); test::NamedInjectedExtension1|namedInjectedExtensionMethod1(c); test::NamedInjectedExtension1|_namedInjectedExtensionPrivateMethod1(c); - test::_extension#1|unnamedInjectedExtensionMethod1(c); - test::_extension#1|_unnamedInjectedExtensionPrivateMethod1(c); + test::_extension#4|unnamedInjectedExtensionMethod1(c); + test::_extension#4|_unnamedInjectedExtensionPrivateMethod1(c); test::NamedInjectedExtension2|namedInjectedExtensionMethod2(c); test::NamedInjectedExtension2|_namedInjectedExtensionPrivateMethod2(c); - test::_extension#3|unnamedInjectedExtensionMethod2(c); - test::_extension#3|_unnamedInjectedExtensionPrivateMethod2(c); + test::_extension#5|unnamedInjectedExtensionMethod2(c); + test::_extension#5|_unnamedInjectedExtensionPrivateMethod2(c); } static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ NamedInjectedExtension2|namedInjectedExtensionMethod2(lowered final test::Class #this) → void {} static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ NamedInjectedExtension2|get#namedInjectedExtensionMethod2(lowered final test::Class #this) → () → void @@ -295,12 +295,12 @@ static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ NamedInjectedExtension2|_namedInjectedExtensionPrivateMethod2(lowered final test::Class #this) → void {} static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ NamedInjectedExtension2|get#_namedInjectedExtensionPrivateMethod2(lowered final test::Class #this) → () → void return () → void => test::NamedInjectedExtension2|_namedInjectedExtensionPrivateMethod2(#this); -static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ _extension#3|unnamedInjectedExtensionMethod2(lowered final test::Class #this) → void {} -static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ _extension#3|get#unnamedInjectedExtensionMethod2(lowered final test::Class #this) → () → void - return () → void => test::_extension#3|unnamedInjectedExtensionMethod2(#this); -static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ _extension#3|_unnamedInjectedExtensionPrivateMethod2(lowered final test::Class #this) → void {} -static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ _extension#3|get#_unnamedInjectedExtensionPrivateMethod2(lowered final test::Class #this) → () → void - return () → void => test::_extension#3|_unnamedInjectedExtensionPrivateMethod2(#this); +static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ _extension#5|unnamedInjectedExtensionMethod2(lowered final test::Class #this) → void {} +static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ _extension#5|get#unnamedInjectedExtensionMethod2(lowered final test::Class #this) → () → void + return () → void => test::_extension#5|unnamedInjectedExtensionMethod2(#this); +static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ _extension#5|_unnamedInjectedExtensionPrivateMethod2(lowered final test::Class #this) → void {} +static extension-member method /* from org-dartlang-testcase:///patch_lib2.dart */ _extension#5|get#_unnamedInjectedExtensionPrivateMethod2(lowered final test::Class #this) → () → void + return () → void => test::_extension#5|_unnamedInjectedExtensionPrivateMethod2(#this); constants { #C1 = _in::_Patch {} diff --git a/pkg/front_end/testcases/general/patch_prefix_access/libraries.json b/pkg/front_end/testcases/general/patch_prefix_access/libraries.json new file mode 100644 index 00000000000..79373ada6d4 --- /dev/null +++ b/pkg/front_end/testcases/general/patch_prefix_access/libraries.json @@ -0,0 +1,13 @@ +{ + "vm": { + "comment:0": "This adds to the default libraries found in the platform.", + "libraries": { + "test": { + "patches": [ + "patch_lib.dart" + ], + "uri": "origin_lib.dart" + } + } + } +} diff --git a/pkg/front_end/testcases/general/patch_prefix_access/main.dart b/pkg/front_end/testcases/general/patch_prefix_access/main.dart new file mode 100644 index 00000000000..f6ad47fbd16 --- /dev/null +++ b/pkg/front_end/testcases/general/patch_prefix_access/main.dart @@ -0,0 +1,9 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:test'; + +main() { + Class().method(); +} diff --git a/pkg/front_end/testcases/general/patch_prefix_access/main.dart.strong.expect b/pkg/front_end/testcases/general/patch_prefix_access/main.dart.strong.expect new file mode 100644 index 00000000000..9f93060c557 --- /dev/null +++ b/pkg/front_end/testcases/general/patch_prefix_access/main.dart.strong.expect @@ -0,0 +1,52 @@ +library; +import self as self; +import "dart:test" as test; +import "dart:core" as core; + +import "dart:test"; + +static method main() → dynamic { + new test::Class::•().{test::Class::method}(){() → core::int}; +} + +library; +import self as test; +import "dart:_internal" as _in; +import "dart:core" as core; + +import "dart:_internal"; +import "org-dartlang-testcase:///main_lib.dart" as prefix; + +@/* from org-dartlang-testcase:///patch_lib.dart */ #C1 +class Class extends core::Object { + field core::int _field = #C2 /* from org-dartlang-testcase:///patch_lib.dart */; + synthetic constructor •() → test::Class + : super core::Object::•() + ; + @#C1 + method /* from org-dartlang-testcase:///patch_lib.dart */ method() → core::int + return #C2; +} +@#C1 +extension Extension on core::int { + method method = test::Extension|method; + method tearoff method = test::Extension|get#method; + static field _field = test::Extension|_field; +} +static field core::int Extension|_field = #C2 /* from org-dartlang-testcase:///patch_lib.dart */; +@#C1 +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|method(lowered final core::int #this) → core::int + return #C2; +static extension-member method Extension|get#method(lowered final core::int #this) → () → core::int + return () → core::int => test::Extension|method(#this); + +library; +import self as self2; +import "dart:core" as core; + +static const field core::int value = #C2; + +constants { + #C1 = _in::_Patch {} + #C2 = 5 +} diff --git a/pkg/front_end/testcases/general/patch_prefix_access/main.dart.strong.modular.expect b/pkg/front_end/testcases/general/patch_prefix_access/main.dart.strong.modular.expect new file mode 100644 index 00000000000..9f93060c557 --- /dev/null +++ b/pkg/front_end/testcases/general/patch_prefix_access/main.dart.strong.modular.expect @@ -0,0 +1,52 @@ +library; +import self as self; +import "dart:test" as test; +import "dart:core" as core; + +import "dart:test"; + +static method main() → dynamic { + new test::Class::•().{test::Class::method}(){() → core::int}; +} + +library; +import self as test; +import "dart:_internal" as _in; +import "dart:core" as core; + +import "dart:_internal"; +import "org-dartlang-testcase:///main_lib.dart" as prefix; + +@/* from org-dartlang-testcase:///patch_lib.dart */ #C1 +class Class extends core::Object { + field core::int _field = #C2 /* from org-dartlang-testcase:///patch_lib.dart */; + synthetic constructor •() → test::Class + : super core::Object::•() + ; + @#C1 + method /* from org-dartlang-testcase:///patch_lib.dart */ method() → core::int + return #C2; +} +@#C1 +extension Extension on core::int { + method method = test::Extension|method; + method tearoff method = test::Extension|get#method; + static field _field = test::Extension|_field; +} +static field core::int Extension|_field = #C2 /* from org-dartlang-testcase:///patch_lib.dart */; +@#C1 +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|method(lowered final core::int #this) → core::int + return #C2; +static extension-member method Extension|get#method(lowered final core::int #this) → () → core::int + return () → core::int => test::Extension|method(#this); + +library; +import self as self2; +import "dart:core" as core; + +static const field core::int value = #C2; + +constants { + #C1 = _in::_Patch {} + #C2 = 5 +} diff --git a/pkg/front_end/testcases/general/patch_prefix_access/main.dart.strong.outline.expect b/pkg/front_end/testcases/general/patch_prefix_access/main.dart.strong.outline.expect new file mode 100644 index 00000000000..86f00a599f7 --- /dev/null +++ b/pkg/front_end/testcases/general/patch_prefix_access/main.dart.strong.outline.expect @@ -0,0 +1,49 @@ +library; +import self as self; + +import "dart:test"; + +static method main() → dynamic + ; + +library; +import self as self2; +import "dart:_internal" as _in; +import "dart:core" as core; + +import "dart:_internal"; +import "org-dartlang-testcase:///main_lib.dart" as prefix; + +@/* from org-dartlang-testcase:///patch_lib.dart */ _in::patch +class Class extends core::Object { + field core::int _field /* from org-dartlang-testcase:///patch_lib.dart */; + synthetic constructor •() → self2::Class + ; + @_in::patch + external method method() → core::int; +} +@_in::patch +extension Extension on core::int { + method method = self2::Extension|method; + method tearoff method = self2::Extension|get#method; + static field _field = self2::Extension|_field; +} +static field core::int Extension|_field /* from org-dartlang-testcase:///patch_lib.dart */; +@_in::patch +external static extension-member method Extension|method(lowered final core::int #this) → core::int; +static extension-member method Extension|get#method(lowered final core::int #this) → () → core::int + return () → core::int => self2::Extension|method(#this); + +library; +import self as self3; +import "dart:core" as core; + +static const field core::int value = 5; + + +Extra constant evaluation status: +Evaluated: FileUriExpression @ org-dartlang-testcase:///patch_lib.dart:9:1 -> InstanceConstant(const _Patch{}) +Evaluated: StaticGet @ (unknown position in org-dartlang-testcase:///origin_lib.dart) -> InstanceConstant(const _Patch{}) +Evaluated: StaticGet @ (unknown position in org-dartlang-testcase:///origin_lib.dart) -> InstanceConstant(const _Patch{}) +Evaluated: StaticGet @ (unknown position in org-dartlang-testcase:///origin_lib.dart) -> InstanceConstant(const _Patch{}) +Extra constant evaluation: evaluated: 7, effectively constant: 4 diff --git a/pkg/front_end/testcases/general/patch_prefix_access/main.dart.strong.transformed.expect b/pkg/front_end/testcases/general/patch_prefix_access/main.dart.strong.transformed.expect new file mode 100644 index 00000000000..9f93060c557 --- /dev/null +++ b/pkg/front_end/testcases/general/patch_prefix_access/main.dart.strong.transformed.expect @@ -0,0 +1,52 @@ +library; +import self as self; +import "dart:test" as test; +import "dart:core" as core; + +import "dart:test"; + +static method main() → dynamic { + new test::Class::•().{test::Class::method}(){() → core::int}; +} + +library; +import self as test; +import "dart:_internal" as _in; +import "dart:core" as core; + +import "dart:_internal"; +import "org-dartlang-testcase:///main_lib.dart" as prefix; + +@/* from org-dartlang-testcase:///patch_lib.dart */ #C1 +class Class extends core::Object { + field core::int _field = #C2 /* from org-dartlang-testcase:///patch_lib.dart */; + synthetic constructor •() → test::Class + : super core::Object::•() + ; + @#C1 + method /* from org-dartlang-testcase:///patch_lib.dart */ method() → core::int + return #C2; +} +@#C1 +extension Extension on core::int { + method method = test::Extension|method; + method tearoff method = test::Extension|get#method; + static field _field = test::Extension|_field; +} +static field core::int Extension|_field = #C2 /* from org-dartlang-testcase:///patch_lib.dart */; +@#C1 +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|method(lowered final core::int #this) → core::int + return #C2; +static extension-member method Extension|get#method(lowered final core::int #this) → () → core::int + return () → core::int => test::Extension|method(#this); + +library; +import self as self2; +import "dart:core" as core; + +static const field core::int value = #C2; + +constants { + #C1 = _in::_Patch {} + #C2 = 5 +} diff --git a/pkg/front_end/testcases/general/patch_prefix_access/main.dart.textual_outline.expect b/pkg/front_end/testcases/general/patch_prefix_access/main.dart.textual_outline.expect new file mode 100644 index 00000000000..3c9c90e9437 --- /dev/null +++ b/pkg/front_end/testcases/general/patch_prefix_access/main.dart.textual_outline.expect @@ -0,0 +1,3 @@ +import 'dart:test'; + +main() {} diff --git a/pkg/front_end/testcases/general/patch_prefix_access/main.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/general/patch_prefix_access/main.dart.textual_outline_modelled.expect new file mode 100644 index 00000000000..3c9c90e9437 --- /dev/null +++ b/pkg/front_end/testcases/general/patch_prefix_access/main.dart.textual_outline_modelled.expect @@ -0,0 +1,3 @@ +import 'dart:test'; + +main() {} diff --git a/pkg/front_end/testcases/general/patch_prefix_access/main_lib.dart b/pkg/front_end/testcases/general/patch_prefix_access/main_lib.dart new file mode 100644 index 00000000000..f716d85b6bd --- /dev/null +++ b/pkg/front_end/testcases/general/patch_prefix_access/main_lib.dart @@ -0,0 +1,5 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +const int value = 5; diff --git a/pkg/front_end/testcases/general/patch_prefix_access/origin_lib.dart b/pkg/front_end/testcases/general/patch_prefix_access/origin_lib.dart new file mode 100644 index 00000000000..ce13e6a1ddf --- /dev/null +++ b/pkg/front_end/testcases/general/patch_prefix_access/origin_lib.dart @@ -0,0 +1,11 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +class Class { + external int method(); +} + +extension Extension on int { + external int method(); +} diff --git a/pkg/front_end/testcases/general/patch_prefix_access/patch_lib.dart b/pkg/front_end/testcases/general/patch_prefix_access/patch_lib.dart new file mode 100644 index 00000000000..511df0aa545 --- /dev/null +++ b/pkg/front_end/testcases/general/patch_prefix_access/patch_lib.dart @@ -0,0 +1,23 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// ignore: import_internal_library +import 'dart:_internal'; +import 'main_lib.dart' as prefix; + +@patch +class Class { + int _field = prefix.value; + + @patch + int method() => prefix.value; +} + +@patch +extension Extension on int { + static int _field = prefix.value; + + @patch + int method() => prefix.value; +} diff --git a/pkg/front_end/testcases/general/patch_type_parameters/libraries.json b/pkg/front_end/testcases/general/patch_type_parameters/libraries.json new file mode 100644 index 00000000000..79373ada6d4 --- /dev/null +++ b/pkg/front_end/testcases/general/patch_type_parameters/libraries.json @@ -0,0 +1,13 @@ +{ + "vm": { + "comment:0": "This adds to the default libraries found in the platform.", + "libraries": { + "test": { + "patches": [ + "patch_lib.dart" + ], + "uri": "origin_lib.dart" + } + } + } +} diff --git a/pkg/front_end/testcases/general/patch_type_parameters/main.dart b/pkg/front_end/testcases/general/patch_type_parameters/main.dart new file mode 100644 index 00000000000..e479d139272 --- /dev/null +++ b/pkg/front_end/testcases/general/patch_type_parameters/main.dart @@ -0,0 +1,14 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:test'; + +main() { + Class().method(); // Ok +} + +test() { + Class(); // Error + Class().method(); // Error +} diff --git a/pkg/front_end/testcases/general/patch_type_parameters/main.dart.strong.expect b/pkg/front_end/testcases/general/patch_type_parameters/main.dart.strong.expect new file mode 100644 index 00000000000..84843bb8b47 --- /dev/null +++ b/pkg/front_end/testcases/general/patch_type_parameters/main.dart.strong.expect @@ -0,0 +1,58 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/general/patch_type_parameters/main.dart:12:3: Error: Type argument 'Bound?' doesn't conform to the bound 'Bound' of the type variable 'T' on 'Class'. +// - 'Bound' is from 'dart:test'. +// Try changing type arguments so that they conform to the bounds. +// Class(); // Error +// ^ +// pkg/front_end/testcases/general/patch_type_parameters/origin_lib.dart:7:13: Context: This is the type variable whose bound isn't conformed to. +// class Class { +// ^ +// +// pkg/front_end/testcases/general/patch_type_parameters/main.dart:13:18: Error: Type argument 'Bound?' doesn't conform to the bound 'Object' of the type variable 'S' on 'Class.method'. +// - 'Bound' is from 'dart:test'. +// - 'Object' is from 'dart:core'. +// - 'Class' is from 'dart:test'. +// Try changing type arguments so that they conform to the bounds. +// Class().method(); // Error +// ^ +// +import self as self; +import "dart:test" as test; + +import "dart:test"; + +static method main() → dynamic { + new test::Class::•().{test::Class::method}(){() → void}; +} +static method test() → dynamic { + new test::Class::•(); + new test::Class::•().{test::Class::method}(){() → void}; +} + +library; +import self as test; +import "dart:core" as core; +import "dart:_internal" as _in; + +import "dart:_internal"; + +class Bound extends core::Object { + synthetic constructor •() → test::Bound + : super core::Object::•() + ; +} +@/* from org-dartlang-testcase:///patch_lib.dart */ #C1 +class Class extends core::Object { + synthetic constructor •() → test::Class + : super core::Object::•() + ; + @#C1 + method /* from org-dartlang-testcase:///patch_lib.dart */ method() → void {} +} + +constants { + #C1 = _in::_Patch {} +} diff --git a/pkg/front_end/testcases/general/patch_type_parameters/main.dart.strong.modular.expect b/pkg/front_end/testcases/general/patch_type_parameters/main.dart.strong.modular.expect new file mode 100644 index 00000000000..84843bb8b47 --- /dev/null +++ b/pkg/front_end/testcases/general/patch_type_parameters/main.dart.strong.modular.expect @@ -0,0 +1,58 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/general/patch_type_parameters/main.dart:12:3: Error: Type argument 'Bound?' doesn't conform to the bound 'Bound' of the type variable 'T' on 'Class'. +// - 'Bound' is from 'dart:test'. +// Try changing type arguments so that they conform to the bounds. +// Class(); // Error +// ^ +// pkg/front_end/testcases/general/patch_type_parameters/origin_lib.dart:7:13: Context: This is the type variable whose bound isn't conformed to. +// class Class { +// ^ +// +// pkg/front_end/testcases/general/patch_type_parameters/main.dart:13:18: Error: Type argument 'Bound?' doesn't conform to the bound 'Object' of the type variable 'S' on 'Class.method'. +// - 'Bound' is from 'dart:test'. +// - 'Object' is from 'dart:core'. +// - 'Class' is from 'dart:test'. +// Try changing type arguments so that they conform to the bounds. +// Class().method(); // Error +// ^ +// +import self as self; +import "dart:test" as test; + +import "dart:test"; + +static method main() → dynamic { + new test::Class::•().{test::Class::method}(){() → void}; +} +static method test() → dynamic { + new test::Class::•(); + new test::Class::•().{test::Class::method}(){() → void}; +} + +library; +import self as test; +import "dart:core" as core; +import "dart:_internal" as _in; + +import "dart:_internal"; + +class Bound extends core::Object { + synthetic constructor •() → test::Bound + : super core::Object::•() + ; +} +@/* from org-dartlang-testcase:///patch_lib.dart */ #C1 +class Class extends core::Object { + synthetic constructor •() → test::Class + : super core::Object::•() + ; + @#C1 + method /* from org-dartlang-testcase:///patch_lib.dart */ method() → void {} +} + +constants { + #C1 = _in::_Patch {} +} diff --git a/pkg/front_end/testcases/general/patch_type_parameters/main.dart.strong.outline.expect b/pkg/front_end/testcases/general/patch_type_parameters/main.dart.strong.outline.expect new file mode 100644 index 00000000000..84986689189 --- /dev/null +++ b/pkg/front_end/testcases/general/patch_type_parameters/main.dart.strong.outline.expect @@ -0,0 +1,34 @@ +library; +import self as self; + +import "dart:test"; + +static method main() → dynamic + ; +static method test() → dynamic + ; + +library; +import self as self2; +import "dart:core" as core; +import "dart:_internal" as _in; + +import "dart:_internal"; + +class Bound extends core::Object { + synthetic constructor •() → self2::Bound + ; +} +@/* from org-dartlang-testcase:///patch_lib.dart */ _in::patch +class Class extends core::Object { + synthetic constructor •() → self2::Class + ; + @_in::patch + external method method() → void; +} + + +Extra constant evaluation status: +Evaluated: FileUriExpression @ org-dartlang-testcase:///patch_lib.dart:8:1 -> InstanceConstant(const _Patch{}) +Evaluated: StaticGet @ (unknown position in org-dartlang-testcase:///origin_lib.dart) -> InstanceConstant(const _Patch{}) +Extra constant evaluation: evaluated: 2, effectively constant: 2 diff --git a/pkg/front_end/testcases/general/patch_type_parameters/main.dart.strong.transformed.expect b/pkg/front_end/testcases/general/patch_type_parameters/main.dart.strong.transformed.expect new file mode 100644 index 00000000000..84843bb8b47 --- /dev/null +++ b/pkg/front_end/testcases/general/patch_type_parameters/main.dart.strong.transformed.expect @@ -0,0 +1,58 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/general/patch_type_parameters/main.dart:12:3: Error: Type argument 'Bound?' doesn't conform to the bound 'Bound' of the type variable 'T' on 'Class'. +// - 'Bound' is from 'dart:test'. +// Try changing type arguments so that they conform to the bounds. +// Class(); // Error +// ^ +// pkg/front_end/testcases/general/patch_type_parameters/origin_lib.dart:7:13: Context: This is the type variable whose bound isn't conformed to. +// class Class { +// ^ +// +// pkg/front_end/testcases/general/patch_type_parameters/main.dart:13:18: Error: Type argument 'Bound?' doesn't conform to the bound 'Object' of the type variable 'S' on 'Class.method'. +// - 'Bound' is from 'dart:test'. +// - 'Object' is from 'dart:core'. +// - 'Class' is from 'dart:test'. +// Try changing type arguments so that they conform to the bounds. +// Class().method(); // Error +// ^ +// +import self as self; +import "dart:test" as test; + +import "dart:test"; + +static method main() → dynamic { + new test::Class::•().{test::Class::method}(){() → void}; +} +static method test() → dynamic { + new test::Class::•(); + new test::Class::•().{test::Class::method}(){() → void}; +} + +library; +import self as test; +import "dart:core" as core; +import "dart:_internal" as _in; + +import "dart:_internal"; + +class Bound extends core::Object { + synthetic constructor •() → test::Bound + : super core::Object::•() + ; +} +@/* from org-dartlang-testcase:///patch_lib.dart */ #C1 +class Class extends core::Object { + synthetic constructor •() → test::Class + : super core::Object::•() + ; + @#C1 + method /* from org-dartlang-testcase:///patch_lib.dart */ method() → void {} +} + +constants { + #C1 = _in::_Patch {} +} diff --git a/pkg/front_end/testcases/general/patch_type_parameters/main.dart.textual_outline.expect b/pkg/front_end/testcases/general/patch_type_parameters/main.dart.textual_outline.expect new file mode 100644 index 00000000000..03bba73289a --- /dev/null +++ b/pkg/front_end/testcases/general/patch_type_parameters/main.dart.textual_outline.expect @@ -0,0 +1,5 @@ +import 'dart:test'; + +main() {} + +test() {} diff --git a/pkg/front_end/testcases/general/patch_type_parameters/main.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/general/patch_type_parameters/main.dart.textual_outline_modelled.expect new file mode 100644 index 00000000000..03bba73289a --- /dev/null +++ b/pkg/front_end/testcases/general/patch_type_parameters/main.dart.textual_outline_modelled.expect @@ -0,0 +1,5 @@ +import 'dart:test'; + +main() {} + +test() {} diff --git a/pkg/front_end/testcases/general/patch_type_parameters/origin_lib.dart b/pkg/front_end/testcases/general/patch_type_parameters/origin_lib.dart new file mode 100644 index 00000000000..7da39f96067 --- /dev/null +++ b/pkg/front_end/testcases/general/patch_type_parameters/origin_lib.dart @@ -0,0 +1,9 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +class Bound {} + +class Class { + external void method(); +} diff --git a/pkg/front_end/testcases/general/patch_type_parameters/patch_lib.dart b/pkg/front_end/testcases/general/patch_type_parameters/patch_lib.dart new file mode 100644 index 00000000000..3a7e98ddb4f --- /dev/null +++ b/pkg/front_end/testcases/general/patch_type_parameters/patch_lib.dart @@ -0,0 +1,12 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// ignore: import_internal_library +import 'dart:_internal'; + +@patch +class Class { + @patch + void method() {} +} diff --git a/pkg/front_end/testcases/general/patching/libraries.json b/pkg/front_end/testcases/general/patching/libraries.json new file mode 100644 index 00000000000..79373ada6d4 --- /dev/null +++ b/pkg/front_end/testcases/general/patching/libraries.json @@ -0,0 +1,13 @@ +{ + "vm": { + "comment:0": "This adds to the default libraries found in the platform.", + "libraries": { + "test": { + "patches": [ + "patch_lib.dart" + ], + "uri": "origin_lib.dart" + } + } + } +} diff --git a/pkg/front_end/testcases/general/patching/main.dart b/pkg/front_end/testcases/general/patching/main.dart new file mode 100644 index 00000000000..b9a694d2dcf --- /dev/null +++ b/pkg/front_end/testcases/general/patching/main.dart @@ -0,0 +1,33 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:test'; + +main() { + topLevelSetter = topLevelGetter; + topLevelMethod(42); + topLevelMethod; + var c = Class(42); + Class.new; + Class.redirecting(42); + Class.redirecting; + Class.factory(42); + Class.factory; + Class.redirectingFactory(42); + Class.redirectingFactory; + c.instanceSetter = c.instanceGetter; + c.instanceMethod(42); + c.instanceMethod; + c + c; + Class.staticSetter = Class.staticGetter; + Class.staticMethod(42); + Class.staticMethod; + c.extensionInstanceSetter = c.extensionInstanceGetter; + c.extensionInstanceMethod(42); + c.extensionInstanceMethod; + c - c; + Extension.extensionStaticSetter = Extension.extensionStaticGetter; + Extension.extensionStaticMethod(42); + Extension.extensionStaticMethod; +} diff --git a/pkg/front_end/testcases/general/patching/main.dart.strong.expect b/pkg/front_end/testcases/general/patching/main.dart.strong.expect new file mode 100644 index 00000000000..62bfec38e75 --- /dev/null +++ b/pkg/front_end/testcases/general/patching/main.dart.strong.expect @@ -0,0 +1,238 @@ +library; +import self as self; +import "dart:test" as test; +import "dart:core" as core; + +import "dart:test"; + +static method main() → dynamic { + test::topLevelSetter = test::topLevelGetter; + test::topLevelMethod(42); + #C1; + test::Class c = new test::Class::•(42); + #C2; + new test::Class::redirecting(42); + #C3; + test::Class::factory(42); + #C4; + new test::Class::•(42); + #C5; + c.{test::Class::instanceSetter} = c.{test::Class::instanceGetter}{core::int}; + c.{test::Class::instanceMethod}(42){(core::int) → void}; + c.{test::Class::instanceMethod}{(core::int) → void}; + c.{test::Class::+}(c){(test::Class) → test::Class}; + test::Class::staticSetter = test::Class::staticGetter; + test::Class::staticMethod(42); + #C6; + test::Extension|set#extensionInstanceSetter(c, test::Extension|get#extensionInstanceGetter(c)); + test::Extension|extensionInstanceMethod(c, 42); + test::Extension|get#extensionInstanceMethod(c); + test::Extension|-(c, c); + test::Extension|extensionStaticSetter = test::Extension|extensionStaticGetter; + test::Extension|extensionStaticMethod(42); + #C7; +} + +library; +import self as test; +import "dart:_internal" as _in; +import "dart:core" as core; + +import "dart:_internal"; + +@/* from org-dartlang-testcase:///patch_lib.dart */ #C8 +class Class extends core::Object { + @#C8 + constructor /* from org-dartlang-testcase:///patch_lib.dart */ •(core::int value) → test::Class + : super core::Object::•() + ; + @#C8 + constructor /* from org-dartlang-testcase:///patch_lib.dart */ redirecting(core::int value) → test::Class + : this test::Class::•(value) + ; + constructor /* from org-dartlang-testcase:///patch_lib.dart */ _injectedGenerative(core::int value) → test::Class + : super core::Object::•() + ; + constructor /* from org-dartlang-testcase:///patch_lib.dart */ _injectedRedirecting(core::int value) → test::Class + : this test::Class::•(value) + ; + @#C8 + static factory /* from org-dartlang-testcase:///patch_lib.dart */ factory(core::int value) → test::Class + return new test::Class::•(value); + @#C8 + static factory /* from org-dartlang-testcase:///patch_lib.dart */ redirectingFactory(core::int value) → test::Class /* redirection-target: test::Class::• */ + return new test::Class::•(value); + @#C8 + get /* from org-dartlang-testcase:///patch_lib.dart */ instanceGetter() → core::int + return 42; + @#C8 + set /* from org-dartlang-testcase:///patch_lib.dart */ instanceSetter(core::int value) → void {} + @#C8 + method /* from org-dartlang-testcase:///patch_lib.dart */ instanceMethod(core::int value) → void {} + @#C8 + operator /* from org-dartlang-testcase:///patch_lib.dart */ +(test::Class a) → test::Class + return this; + @#C8 + static get /* from org-dartlang-testcase:///patch_lib.dart */ staticGetter() → core::int + return 42; + @#C8 + static set /* from org-dartlang-testcase:///patch_lib.dart */ staticSetter(core::int value) → void {} + @#C8 + static method /* from org-dartlang-testcase:///patch_lib.dart */ staticMethod(core::int value) → void {} + static factory /* from org-dartlang-testcase:///patch_lib.dart */ _injectedFactory(core::int value) → test::Class + return new test::Class::•(value); + static factory /* from org-dartlang-testcase:///patch_lib.dart */ _injectedRedirectingFactory(core::int value) → test::Class /* redirection-target: test::Class::• */ + return new test::Class::•(value); + get /* from org-dartlang-testcase:///patch_lib.dart */ _injectedInstanceGetter() → core::int + return 42; + set /* from org-dartlang-testcase:///patch_lib.dart */ _injectedInstanceSetter(core::int value) → void {} + method /* from org-dartlang-testcase:///patch_lib.dart */ _injectedInstanceMethod(core::int value) → void {} + static get /* from org-dartlang-testcase:///patch_lib.dart */ _injectedStaticGetter() → core::int + return 42; + static set /* from org-dartlang-testcase:///patch_lib.dart */ _injectedStaticSetter(core::int value) → void {} + static method /* from org-dartlang-testcase:///patch_lib.dart */ _injectedStaticMethod(core::int value) → void {} +} +class _InjectedClass extends core::Object { // from org-dartlang-testcase:///patch_lib.dart + field core::int instanceField = 42; + static field core::int staticField = 42; + constructor •(core::int value) → test::_InjectedClass + : super core::Object::•() + ; + constructor redirecting(core::int value) → test::_InjectedClass + : this test::_InjectedClass::•(value) + ; + static factory factory(core::int value) → test::_InjectedClass + return new test::_InjectedClass::•(value); + static factory redirectingFactory(core::int value) → test::_InjectedClass /* redirection-target: test::_InjectedClass::• */ + return new test::_InjectedClass::•(value); + get instanceGetter() → core::int + return 42; + set instanceSetter(core::int value) → void {} + method instanceMethod(core::int value) → void {} + static get staticGetter() → core::int + return 42; + static set staticSetter(core::int value) → void {} + static method staticMethod(core::int value) → void {} +} +@#C8 +extension Extension on test::Class { + get extensionInstanceGetter = test::Extension|get#extensionInstanceGetter; + method extensionInstanceMethod = test::Extension|extensionInstanceMethod; + method tearoff extensionInstanceMethod = test::Extension|get#extensionInstanceMethod; + operator - = test::Extension|-; + static get extensionStaticGetter = get test::Extension|extensionStaticGetter; + static method extensionStaticMethod = test::Extension|extensionStaticMethod; + get _injectedExtensionInstanceGetter = test::Extension|get#_injectedExtensionInstanceGetter; + method _injectedExtensionInstanceMethod = test::Extension|_injectedExtensionInstanceMethod; + method tearoff _injectedExtensionInstanceMethod = test::Extension|get#_injectedExtensionInstanceMethod; + static field _injectedExtensionStaticField = test::Extension|_injectedExtensionStaticField; + static get _injectedExtensionStaticGetter = get test::Extension|_injectedExtensionStaticGetter; + static method _injectedExtensionStaticMethod = test::Extension|_injectedExtensionStaticMethod; + set extensionInstanceSetter = test::Extension|set#extensionInstanceSetter; + static set extensionStaticSetter = set test::Extension|extensionStaticSetter; + set _injectedExtensionInstanceSetter = test::Extension|set#_injectedExtensionInstanceSetter; + static set _injectedExtensionStaticSetter = set test::Extension|_injectedExtensionStaticSetter; +} +static field core::int Extension|_injectedExtensionStaticField = 42 /* from org-dartlang-testcase:///patch_lib.dart */; +@#C8 +static get /* from org-dartlang-testcase:///patch_lib.dart */ topLevelGetter() → core::int + return 42; +@#C8 +static set /* from org-dartlang-testcase:///patch_lib.dart */ topLevelSetter(core::int value) → void {} +@#C8 +static method /* from org-dartlang-testcase:///patch_lib.dart */ topLevelMethod(core::int value) → void {} +@#C8 +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|get#extensionInstanceGetter(lowered final test::Class #this) → core::int + return 42; +@#C8 +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|set#extensionInstanceSetter(lowered final test::Class #this, core::int value) → void {} +@#C8 +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|extensionInstanceMethod(lowered final test::Class #this, core::int value) → void {} +static extension-member method Extension|get#extensionInstanceMethod(lowered final test::Class #this) → (core::int) → void + return (core::int value) → void => test::Extension|extensionInstanceMethod(#this, value); +@#C8 +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|-(lowered final test::Class #this, test::Class a) → test::Class + return #this; +@#C8 +static extension-member get /* from org-dartlang-testcase:///patch_lib.dart */ Extension|extensionStaticGetter() → core::int + return 42; +@#C8 +static extension-member set /* from org-dartlang-testcase:///patch_lib.dart */ Extension|extensionStaticSetter(core::int value) → void {} +@#C8 +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|extensionStaticMethod(core::int value) → void {} +static get /* from org-dartlang-testcase:///patch_lib.dart */ _injectedTopLevelGetter() → core::int + return 42; +static set /* from org-dartlang-testcase:///patch_lib.dart */ _injectedTopLevelSetter(core::int value) → void {} +static method /* from org-dartlang-testcase:///patch_lib.dart */ _injectedTopLevelMethod(core::int value) → void { + test::_injectedTopLevelSetter = test::_injectedTopLevelGetter; + test::_injectedTopLevelMethod(42); + #C9; + test::_InjectedClass i = new test::_InjectedClass::•(42); + #C10; + new test::_InjectedClass::redirecting(42); + #C11; + test::_InjectedClass::factory(42); + #C12; + new test::_InjectedClass::•(42); + #C13; + i.{test::_InjectedClass::instanceSetter} = i.{test::_InjectedClass::instanceGetter}{core::int}; + i.{test::_InjectedClass::instanceMethod}(42){(core::int) → void}; + i.{test::_InjectedClass::instanceMethod}{(core::int) → void}; + test::_InjectedClass::staticSetter = test::_InjectedClass::staticGetter; + test::_InjectedClass::staticMethod(42); + #C14; + test::Class c = new test::Class::•(42); + new test::Class::_injectedGenerative(42); + #C15; + new test::Class::_injectedRedirecting(42); + #C16; + test::Class::_injectedFactory(42); + #C17; + new test::Class::•(42); + #C18; + c.{test::Class::_injectedInstanceSetter} = c.{test::Class::_injectedInstanceGetter}{core::int}; + c.{test::Class::_injectedInstanceMethod}(42){(core::int) → void}; + c.{test::Class::_injectedInstanceMethod}{(core::int) → void}; + test::Class::_injectedStaticSetter = test::Class::_injectedStaticGetter; + test::Class::_injectedStaticMethod(42); + #C19; + test::Extension|set#_injectedExtensionInstanceSetter(c, test::Extension|get#_injectedExtensionInstanceGetter(c)); + test::Extension|_injectedExtensionInstanceMethod(c, 42); + test::Extension|get#_injectedExtensionInstanceMethod(c); + test::Extension|_injectedExtensionStaticSetter = test::Extension|_injectedExtensionStaticGetter; + test::Extension|_injectedExtensionStaticMethod(42); + #C20; +} +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|get#_injectedExtensionInstanceGetter(lowered final test::Class #this) → core::int + return 42; +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|set#_injectedExtensionInstanceSetter(lowered final test::Class #this, core::int value) → void {} +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|_injectedExtensionInstanceMethod(lowered final test::Class #this, core::int value) → void {} +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|get#_injectedExtensionInstanceMethod(lowered final test::Class #this) → (core::int) → void + return (core::int value) → void => test::Extension|_injectedExtensionInstanceMethod(#this, value); +static extension-member get /* from org-dartlang-testcase:///patch_lib.dart */ Extension|_injectedExtensionStaticGetter() → core::int + return 42; +static extension-member set /* from org-dartlang-testcase:///patch_lib.dart */ Extension|_injectedExtensionStaticSetter(core::int value) → void {} +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|_injectedExtensionStaticMethod(core::int value) → void {} + +constants { + #C1 = static-tearoff test::topLevelMethod + #C2 = constructor-tearoff test::Class::• + #C3 = constructor-tearoff test::Class::redirecting + #C4 = constructor-tearoff test::Class::factory + #C5 = redirecting-factory-tearoff test::Class::redirectingFactory + #C6 = static-tearoff test::Class::staticMethod + #C7 = static-tearoff test::Extension|extensionStaticMethod + #C8 = _in::_Patch {} + #C9 = static-tearoff test::_injectedTopLevelMethod + #C10 = constructor-tearoff test::_InjectedClass::• + #C11 = constructor-tearoff test::_InjectedClass::redirecting + #C12 = constructor-tearoff test::_InjectedClass::factory + #C13 = redirecting-factory-tearoff test::_InjectedClass::redirectingFactory + #C14 = static-tearoff test::_InjectedClass::staticMethod + #C15 = constructor-tearoff test::Class::_injectedGenerative + #C16 = constructor-tearoff test::Class::_injectedRedirecting + #C17 = constructor-tearoff test::Class::_injectedFactory + #C18 = redirecting-factory-tearoff test::Class::_injectedRedirectingFactory + #C19 = static-tearoff test::Class::_injectedStaticMethod + #C20 = static-tearoff test::Extension|_injectedExtensionStaticMethod +} diff --git a/pkg/front_end/testcases/general/patching/main.dart.strong.modular.expect b/pkg/front_end/testcases/general/patching/main.dart.strong.modular.expect new file mode 100644 index 00000000000..62bfec38e75 --- /dev/null +++ b/pkg/front_end/testcases/general/patching/main.dart.strong.modular.expect @@ -0,0 +1,238 @@ +library; +import self as self; +import "dart:test" as test; +import "dart:core" as core; + +import "dart:test"; + +static method main() → dynamic { + test::topLevelSetter = test::topLevelGetter; + test::topLevelMethod(42); + #C1; + test::Class c = new test::Class::•(42); + #C2; + new test::Class::redirecting(42); + #C3; + test::Class::factory(42); + #C4; + new test::Class::•(42); + #C5; + c.{test::Class::instanceSetter} = c.{test::Class::instanceGetter}{core::int}; + c.{test::Class::instanceMethod}(42){(core::int) → void}; + c.{test::Class::instanceMethod}{(core::int) → void}; + c.{test::Class::+}(c){(test::Class) → test::Class}; + test::Class::staticSetter = test::Class::staticGetter; + test::Class::staticMethod(42); + #C6; + test::Extension|set#extensionInstanceSetter(c, test::Extension|get#extensionInstanceGetter(c)); + test::Extension|extensionInstanceMethod(c, 42); + test::Extension|get#extensionInstanceMethod(c); + test::Extension|-(c, c); + test::Extension|extensionStaticSetter = test::Extension|extensionStaticGetter; + test::Extension|extensionStaticMethod(42); + #C7; +} + +library; +import self as test; +import "dart:_internal" as _in; +import "dart:core" as core; + +import "dart:_internal"; + +@/* from org-dartlang-testcase:///patch_lib.dart */ #C8 +class Class extends core::Object { + @#C8 + constructor /* from org-dartlang-testcase:///patch_lib.dart */ •(core::int value) → test::Class + : super core::Object::•() + ; + @#C8 + constructor /* from org-dartlang-testcase:///patch_lib.dart */ redirecting(core::int value) → test::Class + : this test::Class::•(value) + ; + constructor /* from org-dartlang-testcase:///patch_lib.dart */ _injectedGenerative(core::int value) → test::Class + : super core::Object::•() + ; + constructor /* from org-dartlang-testcase:///patch_lib.dart */ _injectedRedirecting(core::int value) → test::Class + : this test::Class::•(value) + ; + @#C8 + static factory /* from org-dartlang-testcase:///patch_lib.dart */ factory(core::int value) → test::Class + return new test::Class::•(value); + @#C8 + static factory /* from org-dartlang-testcase:///patch_lib.dart */ redirectingFactory(core::int value) → test::Class /* redirection-target: test::Class::• */ + return new test::Class::•(value); + @#C8 + get /* from org-dartlang-testcase:///patch_lib.dart */ instanceGetter() → core::int + return 42; + @#C8 + set /* from org-dartlang-testcase:///patch_lib.dart */ instanceSetter(core::int value) → void {} + @#C8 + method /* from org-dartlang-testcase:///patch_lib.dart */ instanceMethod(core::int value) → void {} + @#C8 + operator /* from org-dartlang-testcase:///patch_lib.dart */ +(test::Class a) → test::Class + return this; + @#C8 + static get /* from org-dartlang-testcase:///patch_lib.dart */ staticGetter() → core::int + return 42; + @#C8 + static set /* from org-dartlang-testcase:///patch_lib.dart */ staticSetter(core::int value) → void {} + @#C8 + static method /* from org-dartlang-testcase:///patch_lib.dart */ staticMethod(core::int value) → void {} + static factory /* from org-dartlang-testcase:///patch_lib.dart */ _injectedFactory(core::int value) → test::Class + return new test::Class::•(value); + static factory /* from org-dartlang-testcase:///patch_lib.dart */ _injectedRedirectingFactory(core::int value) → test::Class /* redirection-target: test::Class::• */ + return new test::Class::•(value); + get /* from org-dartlang-testcase:///patch_lib.dart */ _injectedInstanceGetter() → core::int + return 42; + set /* from org-dartlang-testcase:///patch_lib.dart */ _injectedInstanceSetter(core::int value) → void {} + method /* from org-dartlang-testcase:///patch_lib.dart */ _injectedInstanceMethod(core::int value) → void {} + static get /* from org-dartlang-testcase:///patch_lib.dart */ _injectedStaticGetter() → core::int + return 42; + static set /* from org-dartlang-testcase:///patch_lib.dart */ _injectedStaticSetter(core::int value) → void {} + static method /* from org-dartlang-testcase:///patch_lib.dart */ _injectedStaticMethod(core::int value) → void {} +} +class _InjectedClass extends core::Object { // from org-dartlang-testcase:///patch_lib.dart + field core::int instanceField = 42; + static field core::int staticField = 42; + constructor •(core::int value) → test::_InjectedClass + : super core::Object::•() + ; + constructor redirecting(core::int value) → test::_InjectedClass + : this test::_InjectedClass::•(value) + ; + static factory factory(core::int value) → test::_InjectedClass + return new test::_InjectedClass::•(value); + static factory redirectingFactory(core::int value) → test::_InjectedClass /* redirection-target: test::_InjectedClass::• */ + return new test::_InjectedClass::•(value); + get instanceGetter() → core::int + return 42; + set instanceSetter(core::int value) → void {} + method instanceMethod(core::int value) → void {} + static get staticGetter() → core::int + return 42; + static set staticSetter(core::int value) → void {} + static method staticMethod(core::int value) → void {} +} +@#C8 +extension Extension on test::Class { + get extensionInstanceGetter = test::Extension|get#extensionInstanceGetter; + method extensionInstanceMethod = test::Extension|extensionInstanceMethod; + method tearoff extensionInstanceMethod = test::Extension|get#extensionInstanceMethod; + operator - = test::Extension|-; + static get extensionStaticGetter = get test::Extension|extensionStaticGetter; + static method extensionStaticMethod = test::Extension|extensionStaticMethod; + get _injectedExtensionInstanceGetter = test::Extension|get#_injectedExtensionInstanceGetter; + method _injectedExtensionInstanceMethod = test::Extension|_injectedExtensionInstanceMethod; + method tearoff _injectedExtensionInstanceMethod = test::Extension|get#_injectedExtensionInstanceMethod; + static field _injectedExtensionStaticField = test::Extension|_injectedExtensionStaticField; + static get _injectedExtensionStaticGetter = get test::Extension|_injectedExtensionStaticGetter; + static method _injectedExtensionStaticMethod = test::Extension|_injectedExtensionStaticMethod; + set extensionInstanceSetter = test::Extension|set#extensionInstanceSetter; + static set extensionStaticSetter = set test::Extension|extensionStaticSetter; + set _injectedExtensionInstanceSetter = test::Extension|set#_injectedExtensionInstanceSetter; + static set _injectedExtensionStaticSetter = set test::Extension|_injectedExtensionStaticSetter; +} +static field core::int Extension|_injectedExtensionStaticField = 42 /* from org-dartlang-testcase:///patch_lib.dart */; +@#C8 +static get /* from org-dartlang-testcase:///patch_lib.dart */ topLevelGetter() → core::int + return 42; +@#C8 +static set /* from org-dartlang-testcase:///patch_lib.dart */ topLevelSetter(core::int value) → void {} +@#C8 +static method /* from org-dartlang-testcase:///patch_lib.dart */ topLevelMethod(core::int value) → void {} +@#C8 +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|get#extensionInstanceGetter(lowered final test::Class #this) → core::int + return 42; +@#C8 +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|set#extensionInstanceSetter(lowered final test::Class #this, core::int value) → void {} +@#C8 +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|extensionInstanceMethod(lowered final test::Class #this, core::int value) → void {} +static extension-member method Extension|get#extensionInstanceMethod(lowered final test::Class #this) → (core::int) → void + return (core::int value) → void => test::Extension|extensionInstanceMethod(#this, value); +@#C8 +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|-(lowered final test::Class #this, test::Class a) → test::Class + return #this; +@#C8 +static extension-member get /* from org-dartlang-testcase:///patch_lib.dart */ Extension|extensionStaticGetter() → core::int + return 42; +@#C8 +static extension-member set /* from org-dartlang-testcase:///patch_lib.dart */ Extension|extensionStaticSetter(core::int value) → void {} +@#C8 +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|extensionStaticMethod(core::int value) → void {} +static get /* from org-dartlang-testcase:///patch_lib.dart */ _injectedTopLevelGetter() → core::int + return 42; +static set /* from org-dartlang-testcase:///patch_lib.dart */ _injectedTopLevelSetter(core::int value) → void {} +static method /* from org-dartlang-testcase:///patch_lib.dart */ _injectedTopLevelMethod(core::int value) → void { + test::_injectedTopLevelSetter = test::_injectedTopLevelGetter; + test::_injectedTopLevelMethod(42); + #C9; + test::_InjectedClass i = new test::_InjectedClass::•(42); + #C10; + new test::_InjectedClass::redirecting(42); + #C11; + test::_InjectedClass::factory(42); + #C12; + new test::_InjectedClass::•(42); + #C13; + i.{test::_InjectedClass::instanceSetter} = i.{test::_InjectedClass::instanceGetter}{core::int}; + i.{test::_InjectedClass::instanceMethod}(42){(core::int) → void}; + i.{test::_InjectedClass::instanceMethod}{(core::int) → void}; + test::_InjectedClass::staticSetter = test::_InjectedClass::staticGetter; + test::_InjectedClass::staticMethod(42); + #C14; + test::Class c = new test::Class::•(42); + new test::Class::_injectedGenerative(42); + #C15; + new test::Class::_injectedRedirecting(42); + #C16; + test::Class::_injectedFactory(42); + #C17; + new test::Class::•(42); + #C18; + c.{test::Class::_injectedInstanceSetter} = c.{test::Class::_injectedInstanceGetter}{core::int}; + c.{test::Class::_injectedInstanceMethod}(42){(core::int) → void}; + c.{test::Class::_injectedInstanceMethod}{(core::int) → void}; + test::Class::_injectedStaticSetter = test::Class::_injectedStaticGetter; + test::Class::_injectedStaticMethod(42); + #C19; + test::Extension|set#_injectedExtensionInstanceSetter(c, test::Extension|get#_injectedExtensionInstanceGetter(c)); + test::Extension|_injectedExtensionInstanceMethod(c, 42); + test::Extension|get#_injectedExtensionInstanceMethod(c); + test::Extension|_injectedExtensionStaticSetter = test::Extension|_injectedExtensionStaticGetter; + test::Extension|_injectedExtensionStaticMethod(42); + #C20; +} +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|get#_injectedExtensionInstanceGetter(lowered final test::Class #this) → core::int + return 42; +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|set#_injectedExtensionInstanceSetter(lowered final test::Class #this, core::int value) → void {} +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|_injectedExtensionInstanceMethod(lowered final test::Class #this, core::int value) → void {} +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|get#_injectedExtensionInstanceMethod(lowered final test::Class #this) → (core::int) → void + return (core::int value) → void => test::Extension|_injectedExtensionInstanceMethod(#this, value); +static extension-member get /* from org-dartlang-testcase:///patch_lib.dart */ Extension|_injectedExtensionStaticGetter() → core::int + return 42; +static extension-member set /* from org-dartlang-testcase:///patch_lib.dart */ Extension|_injectedExtensionStaticSetter(core::int value) → void {} +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|_injectedExtensionStaticMethod(core::int value) → void {} + +constants { + #C1 = static-tearoff test::topLevelMethod + #C2 = constructor-tearoff test::Class::• + #C3 = constructor-tearoff test::Class::redirecting + #C4 = constructor-tearoff test::Class::factory + #C5 = redirecting-factory-tearoff test::Class::redirectingFactory + #C6 = static-tearoff test::Class::staticMethod + #C7 = static-tearoff test::Extension|extensionStaticMethod + #C8 = _in::_Patch {} + #C9 = static-tearoff test::_injectedTopLevelMethod + #C10 = constructor-tearoff test::_InjectedClass::• + #C11 = constructor-tearoff test::_InjectedClass::redirecting + #C12 = constructor-tearoff test::_InjectedClass::factory + #C13 = redirecting-factory-tearoff test::_InjectedClass::redirectingFactory + #C14 = static-tearoff test::_InjectedClass::staticMethod + #C15 = constructor-tearoff test::Class::_injectedGenerative + #C16 = constructor-tearoff test::Class::_injectedRedirecting + #C17 = constructor-tearoff test::Class::_injectedFactory + #C18 = redirecting-factory-tearoff test::Class::_injectedRedirectingFactory + #C19 = static-tearoff test::Class::_injectedStaticMethod + #C20 = static-tearoff test::Extension|_injectedExtensionStaticMethod +} diff --git a/pkg/front_end/testcases/general/patching/main.dart.strong.outline.expect b/pkg/front_end/testcases/general/patching/main.dart.strong.outline.expect new file mode 100644 index 00000000000..184901843e8 --- /dev/null +++ b/pkg/front_end/testcases/general/patching/main.dart.strong.outline.expect @@ -0,0 +1,174 @@ +library; +import self as self; + +import "dart:test"; + +static method main() → dynamic + ; + +library; +import self as self2; +import "dart:_internal" as _in; +import "dart:core" as core; + +import "dart:_internal"; + +@/* from org-dartlang-testcase:///patch_lib.dart */ _in::patch +class Class extends core::Object { + @_in::patch + external constructor •(core::int value) → self2::Class; + @_in::patch + external constructor redirecting(core::int value) → self2::Class; + constructor /* from org-dartlang-testcase:///patch_lib.dart */ _injectedGenerative(core::int value) → self2::Class + ; + constructor /* from org-dartlang-testcase:///patch_lib.dart */ _injectedRedirecting(core::int value) → self2::Class + ; + @_in::patch + external static factory factory(core::int value) → self2::Class; + @_in::patch + external static factory redirectingFactory(core::int value) → self2::Class /* redirection-target: self2::Class::• */ + return new self2::Class::•(value); + @_in::patch + external get instanceGetter() → core::int; + @_in::patch + external set instanceSetter(core::int value) → void; + @_in::patch + external method instanceMethod(core::int value) → void; + @_in::patch + external operator +(self2::Class a) → self2::Class; + @_in::patch + external static get staticGetter() → core::int; + @_in::patch + external static set staticSetter(core::int value) → void; + @_in::patch + external static method staticMethod(core::int value) → void; + static factory /* from org-dartlang-testcase:///patch_lib.dart */ _injectedFactory(core::int value) → self2::Class + ; + static factory /* from org-dartlang-testcase:///patch_lib.dart */ _injectedRedirectingFactory(core::int value) → self2::Class /* redirection-target: self2::Class::• */ + return new self2::Class::•(value); + get /* from org-dartlang-testcase:///patch_lib.dart */ _injectedInstanceGetter() → core::int + ; + set /* from org-dartlang-testcase:///patch_lib.dart */ _injectedInstanceSetter(core::int value) → void + ; + method /* from org-dartlang-testcase:///patch_lib.dart */ _injectedInstanceMethod(core::int value) → void + ; + static get /* from org-dartlang-testcase:///patch_lib.dart */ _injectedStaticGetter() → core::int + ; + static set /* from org-dartlang-testcase:///patch_lib.dart */ _injectedStaticSetter(core::int value) → void + ; + static method /* from org-dartlang-testcase:///patch_lib.dart */ _injectedStaticMethod(core::int value) → void + ; +} +class _InjectedClass extends core::Object { // from org-dartlang-testcase:///patch_lib.dart + field core::int instanceField; + static field core::int staticField; + constructor •(core::int value) → self2::_InjectedClass + ; + constructor redirecting(core::int value) → self2::_InjectedClass + ; + static factory factory(core::int value) → self2::_InjectedClass + ; + static factory redirectingFactory(core::int value) → self2::_InjectedClass /* redirection-target: self2::_InjectedClass::• */ + return new self2::_InjectedClass::•(value); + get instanceGetter() → core::int + ; + set instanceSetter(core::int value) → void + ; + method instanceMethod(core::int value) → void + ; + static get staticGetter() → core::int + ; + static set staticSetter(core::int value) → void + ; + static method staticMethod(core::int value) → void + ; +} +@_in::patch +extension Extension on self2::Class { + get extensionInstanceGetter = self2::Extension|get#extensionInstanceGetter; + method extensionInstanceMethod = self2::Extension|extensionInstanceMethod; + method tearoff extensionInstanceMethod = self2::Extension|get#extensionInstanceMethod; + operator - = self2::Extension|-; + static get extensionStaticGetter = get self2::Extension|extensionStaticGetter; + static method extensionStaticMethod = self2::Extension|extensionStaticMethod; + get _injectedExtensionInstanceGetter = self2::Extension|get#_injectedExtensionInstanceGetter; + method _injectedExtensionInstanceMethod = self2::Extension|_injectedExtensionInstanceMethod; + method tearoff _injectedExtensionInstanceMethod = self2::Extension|get#_injectedExtensionInstanceMethod; + static field _injectedExtensionStaticField = self2::Extension|_injectedExtensionStaticField; + static get _injectedExtensionStaticGetter = get self2::Extension|_injectedExtensionStaticGetter; + static method _injectedExtensionStaticMethod = self2::Extension|_injectedExtensionStaticMethod; + set extensionInstanceSetter = self2::Extension|set#extensionInstanceSetter; + static set extensionStaticSetter = set self2::Extension|extensionStaticSetter; + set _injectedExtensionInstanceSetter = self2::Extension|set#_injectedExtensionInstanceSetter; + static set _injectedExtensionStaticSetter = set self2::Extension|_injectedExtensionStaticSetter; +} +static field core::int Extension|_injectedExtensionStaticField /* from org-dartlang-testcase:///patch_lib.dart */; +@_in::patch +external static get topLevelGetter() → core::int; +@_in::patch +external static set topLevelSetter(core::int value) → void; +@_in::patch +external static method topLevelMethod(core::int value) → void; +@_in::patch +external static extension-member method Extension|get#extensionInstanceGetter(lowered final self2::Class #this) → core::int; +@_in::patch +external static extension-member method Extension|set#extensionInstanceSetter(lowered final self2::Class #this, core::int value) → void; +@_in::patch +external static extension-member method Extension|extensionInstanceMethod(lowered final self2::Class #this, core::int value) → void; +static extension-member method Extension|get#extensionInstanceMethod(lowered final self2::Class #this) → (core::int) → void + return (core::int value) → void => self2::Extension|extensionInstanceMethod(#this, value); +@_in::patch +external static extension-member method Extension|-(lowered final self2::Class #this, self2::Class a) → self2::Class; +@_in::patch +external static extension-member get Extension|extensionStaticGetter() → core::int; +@_in::patch +external static extension-member set Extension|extensionStaticSetter(core::int value) → void; +@_in::patch +external static extension-member method Extension|extensionStaticMethod(core::int value) → void; +static get /* from org-dartlang-testcase:///patch_lib.dart */ _injectedTopLevelGetter() → core::int + ; +static set /* from org-dartlang-testcase:///patch_lib.dart */ _injectedTopLevelSetter(core::int value) → void + ; +static method /* from org-dartlang-testcase:///patch_lib.dart */ _injectedTopLevelMethod(core::int value) → void + ; +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|get#_injectedExtensionInstanceGetter(lowered final self2::Class #this) → core::int + ; +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|set#_injectedExtensionInstanceSetter(lowered final self2::Class #this, core::int value) → void + ; +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|_injectedExtensionInstanceMethod(lowered final self2::Class #this, core::int value) → void + ; +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|get#_injectedExtensionInstanceMethod(lowered final self2::Class #this) → (core::int) → void + return (core::int value) → void => self2::Extension|_injectedExtensionInstanceMethod(#this, value); +static extension-member get /* from org-dartlang-testcase:///patch_lib.dart */ Extension|_injectedExtensionStaticGetter() → core::int + ; +static extension-member set /* from org-dartlang-testcase:///patch_lib.dart */ Extension|_injectedExtensionStaticSetter(core::int value) → void + ; +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|_injectedExtensionStaticMethod(core::int value) → void + ; + + +Extra constant evaluation status: +Evaluated: FileUriExpression @ org-dartlang-testcase:///patch_lib.dart:63:1 -> InstanceConstant(const _Patch{}) +Evaluated: StaticGet @ (unknown position in org-dartlang-testcase:///origin_lib.dart) -> InstanceConstant(const _Patch{}) +Evaluated: StaticGet @ (unknown position in org-dartlang-testcase:///origin_lib.dart) -> InstanceConstant(const _Patch{}) +Evaluated: StaticGet @ (unknown position in org-dartlang-testcase:///origin_lib.dart) -> InstanceConstant(const _Patch{}) +Evaluated: StaticGet @ (unknown position in org-dartlang-testcase:///origin_lib.dart) -> InstanceConstant(const _Patch{}) +Evaluated: StaticGet @ (unknown position in org-dartlang-testcase:///origin_lib.dart) -> InstanceConstant(const _Patch{}) +Evaluated: StaticGet @ (unknown position in org-dartlang-testcase:///origin_lib.dart) -> InstanceConstant(const _Patch{}) +Evaluated: StaticGet @ (unknown position in org-dartlang-testcase:///origin_lib.dart) -> InstanceConstant(const _Patch{}) +Evaluated: StaticGet @ (unknown position in org-dartlang-testcase:///origin_lib.dart) -> InstanceConstant(const _Patch{}) +Evaluated: StaticGet @ (unknown position in org-dartlang-testcase:///origin_lib.dart) -> InstanceConstant(const _Patch{}) +Evaluated: StaticGet @ (unknown position in org-dartlang-testcase:///origin_lib.dart) -> InstanceConstant(const _Patch{}) +Evaluated: StaticGet @ (unknown position in org-dartlang-testcase:///origin_lib.dart) -> InstanceConstant(const _Patch{}) +Evaluated: StaticGet @ (unknown position in org-dartlang-testcase:///origin_lib.dart) -> InstanceConstant(const _Patch{}) +Evaluated: StaticGet @ org-dartlang-testcase:///origin_lib.dart:7:29 -> InstanceConstant(const _Patch{}) +Evaluated: StaticGet @ org-dartlang-testcase:///origin_lib.dart:12:5 -> InstanceConstant(const _Patch{}) +Evaluated: StaticGet @ org-dartlang-testcase:///origin_lib.dart:16:27 -> InstanceConstant(const _Patch{}) +Evaluated: StaticGet @ (unknown position in org-dartlang-testcase:///origin_lib.dart) -> InstanceConstant(const _Patch{}) +Evaluated: StaticGet @ (unknown position in org-dartlang-testcase:///origin_lib.dart) -> InstanceConstant(const _Patch{}) +Evaluated: StaticGet @ (unknown position in org-dartlang-testcase:///origin_lib.dart) -> InstanceConstant(const _Patch{}) +Evaluated: StaticGet @ (unknown position in org-dartlang-testcase:///origin_lib.dart) -> InstanceConstant(const _Patch{}) +Evaluated: StaticGet @ (unknown position in org-dartlang-testcase:///origin_lib.dart) -> InstanceConstant(const _Patch{}) +Evaluated: StaticGet @ (unknown position in org-dartlang-testcase:///origin_lib.dart) -> InstanceConstant(const _Patch{}) +Evaluated: StaticGet @ (unknown position in org-dartlang-testcase:///origin_lib.dart) -> InstanceConstant(const _Patch{}) +Extra constant evaluation: evaluated: 37, effectively constant: 23 diff --git a/pkg/front_end/testcases/general/patching/main.dart.strong.transformed.expect b/pkg/front_end/testcases/general/patching/main.dart.strong.transformed.expect new file mode 100644 index 00000000000..62bfec38e75 --- /dev/null +++ b/pkg/front_end/testcases/general/patching/main.dart.strong.transformed.expect @@ -0,0 +1,238 @@ +library; +import self as self; +import "dart:test" as test; +import "dart:core" as core; + +import "dart:test"; + +static method main() → dynamic { + test::topLevelSetter = test::topLevelGetter; + test::topLevelMethod(42); + #C1; + test::Class c = new test::Class::•(42); + #C2; + new test::Class::redirecting(42); + #C3; + test::Class::factory(42); + #C4; + new test::Class::•(42); + #C5; + c.{test::Class::instanceSetter} = c.{test::Class::instanceGetter}{core::int}; + c.{test::Class::instanceMethod}(42){(core::int) → void}; + c.{test::Class::instanceMethod}{(core::int) → void}; + c.{test::Class::+}(c){(test::Class) → test::Class}; + test::Class::staticSetter = test::Class::staticGetter; + test::Class::staticMethod(42); + #C6; + test::Extension|set#extensionInstanceSetter(c, test::Extension|get#extensionInstanceGetter(c)); + test::Extension|extensionInstanceMethod(c, 42); + test::Extension|get#extensionInstanceMethod(c); + test::Extension|-(c, c); + test::Extension|extensionStaticSetter = test::Extension|extensionStaticGetter; + test::Extension|extensionStaticMethod(42); + #C7; +} + +library; +import self as test; +import "dart:_internal" as _in; +import "dart:core" as core; + +import "dart:_internal"; + +@/* from org-dartlang-testcase:///patch_lib.dart */ #C8 +class Class extends core::Object { + @#C8 + constructor /* from org-dartlang-testcase:///patch_lib.dart */ •(core::int value) → test::Class + : super core::Object::•() + ; + @#C8 + constructor /* from org-dartlang-testcase:///patch_lib.dart */ redirecting(core::int value) → test::Class + : this test::Class::•(value) + ; + constructor /* from org-dartlang-testcase:///patch_lib.dart */ _injectedGenerative(core::int value) → test::Class + : super core::Object::•() + ; + constructor /* from org-dartlang-testcase:///patch_lib.dart */ _injectedRedirecting(core::int value) → test::Class + : this test::Class::•(value) + ; + @#C8 + static factory /* from org-dartlang-testcase:///patch_lib.dart */ factory(core::int value) → test::Class + return new test::Class::•(value); + @#C8 + static factory /* from org-dartlang-testcase:///patch_lib.dart */ redirectingFactory(core::int value) → test::Class /* redirection-target: test::Class::• */ + return new test::Class::•(value); + @#C8 + get /* from org-dartlang-testcase:///patch_lib.dart */ instanceGetter() → core::int + return 42; + @#C8 + set /* from org-dartlang-testcase:///patch_lib.dart */ instanceSetter(core::int value) → void {} + @#C8 + method /* from org-dartlang-testcase:///patch_lib.dart */ instanceMethod(core::int value) → void {} + @#C8 + operator /* from org-dartlang-testcase:///patch_lib.dart */ +(test::Class a) → test::Class + return this; + @#C8 + static get /* from org-dartlang-testcase:///patch_lib.dart */ staticGetter() → core::int + return 42; + @#C8 + static set /* from org-dartlang-testcase:///patch_lib.dart */ staticSetter(core::int value) → void {} + @#C8 + static method /* from org-dartlang-testcase:///patch_lib.dart */ staticMethod(core::int value) → void {} + static factory /* from org-dartlang-testcase:///patch_lib.dart */ _injectedFactory(core::int value) → test::Class + return new test::Class::•(value); + static factory /* from org-dartlang-testcase:///patch_lib.dart */ _injectedRedirectingFactory(core::int value) → test::Class /* redirection-target: test::Class::• */ + return new test::Class::•(value); + get /* from org-dartlang-testcase:///patch_lib.dart */ _injectedInstanceGetter() → core::int + return 42; + set /* from org-dartlang-testcase:///patch_lib.dart */ _injectedInstanceSetter(core::int value) → void {} + method /* from org-dartlang-testcase:///patch_lib.dart */ _injectedInstanceMethod(core::int value) → void {} + static get /* from org-dartlang-testcase:///patch_lib.dart */ _injectedStaticGetter() → core::int + return 42; + static set /* from org-dartlang-testcase:///patch_lib.dart */ _injectedStaticSetter(core::int value) → void {} + static method /* from org-dartlang-testcase:///patch_lib.dart */ _injectedStaticMethod(core::int value) → void {} +} +class _InjectedClass extends core::Object { // from org-dartlang-testcase:///patch_lib.dart + field core::int instanceField = 42; + static field core::int staticField = 42; + constructor •(core::int value) → test::_InjectedClass + : super core::Object::•() + ; + constructor redirecting(core::int value) → test::_InjectedClass + : this test::_InjectedClass::•(value) + ; + static factory factory(core::int value) → test::_InjectedClass + return new test::_InjectedClass::•(value); + static factory redirectingFactory(core::int value) → test::_InjectedClass /* redirection-target: test::_InjectedClass::• */ + return new test::_InjectedClass::•(value); + get instanceGetter() → core::int + return 42; + set instanceSetter(core::int value) → void {} + method instanceMethod(core::int value) → void {} + static get staticGetter() → core::int + return 42; + static set staticSetter(core::int value) → void {} + static method staticMethod(core::int value) → void {} +} +@#C8 +extension Extension on test::Class { + get extensionInstanceGetter = test::Extension|get#extensionInstanceGetter; + method extensionInstanceMethod = test::Extension|extensionInstanceMethod; + method tearoff extensionInstanceMethod = test::Extension|get#extensionInstanceMethod; + operator - = test::Extension|-; + static get extensionStaticGetter = get test::Extension|extensionStaticGetter; + static method extensionStaticMethod = test::Extension|extensionStaticMethod; + get _injectedExtensionInstanceGetter = test::Extension|get#_injectedExtensionInstanceGetter; + method _injectedExtensionInstanceMethod = test::Extension|_injectedExtensionInstanceMethod; + method tearoff _injectedExtensionInstanceMethod = test::Extension|get#_injectedExtensionInstanceMethod; + static field _injectedExtensionStaticField = test::Extension|_injectedExtensionStaticField; + static get _injectedExtensionStaticGetter = get test::Extension|_injectedExtensionStaticGetter; + static method _injectedExtensionStaticMethod = test::Extension|_injectedExtensionStaticMethod; + set extensionInstanceSetter = test::Extension|set#extensionInstanceSetter; + static set extensionStaticSetter = set test::Extension|extensionStaticSetter; + set _injectedExtensionInstanceSetter = test::Extension|set#_injectedExtensionInstanceSetter; + static set _injectedExtensionStaticSetter = set test::Extension|_injectedExtensionStaticSetter; +} +static field core::int Extension|_injectedExtensionStaticField = 42 /* from org-dartlang-testcase:///patch_lib.dart */; +@#C8 +static get /* from org-dartlang-testcase:///patch_lib.dart */ topLevelGetter() → core::int + return 42; +@#C8 +static set /* from org-dartlang-testcase:///patch_lib.dart */ topLevelSetter(core::int value) → void {} +@#C8 +static method /* from org-dartlang-testcase:///patch_lib.dart */ topLevelMethod(core::int value) → void {} +@#C8 +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|get#extensionInstanceGetter(lowered final test::Class #this) → core::int + return 42; +@#C8 +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|set#extensionInstanceSetter(lowered final test::Class #this, core::int value) → void {} +@#C8 +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|extensionInstanceMethod(lowered final test::Class #this, core::int value) → void {} +static extension-member method Extension|get#extensionInstanceMethod(lowered final test::Class #this) → (core::int) → void + return (core::int value) → void => test::Extension|extensionInstanceMethod(#this, value); +@#C8 +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|-(lowered final test::Class #this, test::Class a) → test::Class + return #this; +@#C8 +static extension-member get /* from org-dartlang-testcase:///patch_lib.dart */ Extension|extensionStaticGetter() → core::int + return 42; +@#C8 +static extension-member set /* from org-dartlang-testcase:///patch_lib.dart */ Extension|extensionStaticSetter(core::int value) → void {} +@#C8 +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|extensionStaticMethod(core::int value) → void {} +static get /* from org-dartlang-testcase:///patch_lib.dart */ _injectedTopLevelGetter() → core::int + return 42; +static set /* from org-dartlang-testcase:///patch_lib.dart */ _injectedTopLevelSetter(core::int value) → void {} +static method /* from org-dartlang-testcase:///patch_lib.dart */ _injectedTopLevelMethod(core::int value) → void { + test::_injectedTopLevelSetter = test::_injectedTopLevelGetter; + test::_injectedTopLevelMethod(42); + #C9; + test::_InjectedClass i = new test::_InjectedClass::•(42); + #C10; + new test::_InjectedClass::redirecting(42); + #C11; + test::_InjectedClass::factory(42); + #C12; + new test::_InjectedClass::•(42); + #C13; + i.{test::_InjectedClass::instanceSetter} = i.{test::_InjectedClass::instanceGetter}{core::int}; + i.{test::_InjectedClass::instanceMethod}(42){(core::int) → void}; + i.{test::_InjectedClass::instanceMethod}{(core::int) → void}; + test::_InjectedClass::staticSetter = test::_InjectedClass::staticGetter; + test::_InjectedClass::staticMethod(42); + #C14; + test::Class c = new test::Class::•(42); + new test::Class::_injectedGenerative(42); + #C15; + new test::Class::_injectedRedirecting(42); + #C16; + test::Class::_injectedFactory(42); + #C17; + new test::Class::•(42); + #C18; + c.{test::Class::_injectedInstanceSetter} = c.{test::Class::_injectedInstanceGetter}{core::int}; + c.{test::Class::_injectedInstanceMethod}(42){(core::int) → void}; + c.{test::Class::_injectedInstanceMethod}{(core::int) → void}; + test::Class::_injectedStaticSetter = test::Class::_injectedStaticGetter; + test::Class::_injectedStaticMethod(42); + #C19; + test::Extension|set#_injectedExtensionInstanceSetter(c, test::Extension|get#_injectedExtensionInstanceGetter(c)); + test::Extension|_injectedExtensionInstanceMethod(c, 42); + test::Extension|get#_injectedExtensionInstanceMethod(c); + test::Extension|_injectedExtensionStaticSetter = test::Extension|_injectedExtensionStaticGetter; + test::Extension|_injectedExtensionStaticMethod(42); + #C20; +} +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|get#_injectedExtensionInstanceGetter(lowered final test::Class #this) → core::int + return 42; +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|set#_injectedExtensionInstanceSetter(lowered final test::Class #this, core::int value) → void {} +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|_injectedExtensionInstanceMethod(lowered final test::Class #this, core::int value) → void {} +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|get#_injectedExtensionInstanceMethod(lowered final test::Class #this) → (core::int) → void + return (core::int value) → void => test::Extension|_injectedExtensionInstanceMethod(#this, value); +static extension-member get /* from org-dartlang-testcase:///patch_lib.dart */ Extension|_injectedExtensionStaticGetter() → core::int + return 42; +static extension-member set /* from org-dartlang-testcase:///patch_lib.dart */ Extension|_injectedExtensionStaticSetter(core::int value) → void {} +static extension-member method /* from org-dartlang-testcase:///patch_lib.dart */ Extension|_injectedExtensionStaticMethod(core::int value) → void {} + +constants { + #C1 = static-tearoff test::topLevelMethod + #C2 = constructor-tearoff test::Class::• + #C3 = constructor-tearoff test::Class::redirecting + #C4 = constructor-tearoff test::Class::factory + #C5 = redirecting-factory-tearoff test::Class::redirectingFactory + #C6 = static-tearoff test::Class::staticMethod + #C7 = static-tearoff test::Extension|extensionStaticMethod + #C8 = _in::_Patch {} + #C9 = static-tearoff test::_injectedTopLevelMethod + #C10 = constructor-tearoff test::_InjectedClass::• + #C11 = constructor-tearoff test::_InjectedClass::redirecting + #C12 = constructor-tearoff test::_InjectedClass::factory + #C13 = redirecting-factory-tearoff test::_InjectedClass::redirectingFactory + #C14 = static-tearoff test::_InjectedClass::staticMethod + #C15 = constructor-tearoff test::Class::_injectedGenerative + #C16 = constructor-tearoff test::Class::_injectedRedirecting + #C17 = constructor-tearoff test::Class::_injectedFactory + #C18 = redirecting-factory-tearoff test::Class::_injectedRedirectingFactory + #C19 = static-tearoff test::Class::_injectedStaticMethod + #C20 = static-tearoff test::Extension|_injectedExtensionStaticMethod +} diff --git a/pkg/front_end/testcases/general/patching/main.dart.textual_outline.expect b/pkg/front_end/testcases/general/patching/main.dart.textual_outline.expect new file mode 100644 index 00000000000..3c9c90e9437 --- /dev/null +++ b/pkg/front_end/testcases/general/patching/main.dart.textual_outline.expect @@ -0,0 +1,3 @@ +import 'dart:test'; + +main() {} diff --git a/pkg/front_end/testcases/general/patching/main.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/general/patching/main.dart.textual_outline_modelled.expect new file mode 100644 index 00000000000..3c9c90e9437 --- /dev/null +++ b/pkg/front_end/testcases/general/patching/main.dart.textual_outline_modelled.expect @@ -0,0 +1,3 @@ +import 'dart:test'; + +main() {} diff --git a/pkg/front_end/testcases/general/patching/origin_lib.dart b/pkg/front_end/testcases/general/patching/origin_lib.dart new file mode 100644 index 00000000000..dadf93253cb --- /dev/null +++ b/pkg/front_end/testcases/general/patching/origin_lib.dart @@ -0,0 +1,49 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +external int get topLevelGetter; + +external void set topLevelSetter(int value); + +external void topLevelMethod(int value); + +class Class { + external Class(int value); + + external Class.redirecting(int value); + + external factory Class.factory(int value); + + external factory Class.redirectingFactory(int value); + + external int get instanceGetter; + + external void set instanceSetter(int value); + + external void instanceMethod(int value); + + external Class operator +(Class a); + + external static int get staticGetter; + + external static void set staticSetter(int value); + + external static void staticMethod(int value); +} + +extension Extension on Class { + external int get extensionInstanceGetter; + + external void set extensionInstanceSetter(int value); + + external void extensionInstanceMethod(int value); + + external Class operator -(Class a); + + external static int get extensionStaticGetter; + + external static void set extensionStaticSetter(int value); + + external static void extensionStaticMethod(int value); +} diff --git a/pkg/front_end/testcases/general/patching/patch_lib.dart b/pkg/front_end/testcases/general/patching/patch_lib.dart new file mode 100644 index 00000000000..4879ab1a700 --- /dev/null +++ b/pkg/front_end/testcases/general/patching/patch_lib.dart @@ -0,0 +1,170 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// ignore: import_internal_library +import 'dart:_internal'; + +@patch +int get topLevelGetter => 42; + +int get _injectedTopLevelGetter => 42; + +@patch +void set topLevelSetter(int value) {} + +void set _injectedTopLevelSetter(int value) {} + +@patch +void topLevelMethod(int value) {} + +void _injectedTopLevelMethod(int value) { + _injectedTopLevelSetter = _injectedTopLevelGetter; + _injectedTopLevelMethod(42); + _injectedTopLevelMethod; + var i = _InjectedClass(42); + _InjectedClass.new; + _InjectedClass.redirecting(42); + _InjectedClass.redirecting; + _InjectedClass.factory(42); + _InjectedClass.factory; + _InjectedClass.redirectingFactory(42); + _InjectedClass.redirectingFactory; + i.instanceSetter = i.instanceGetter; + i.instanceMethod(42); + i.instanceMethod; + _InjectedClass.staticSetter = _InjectedClass.staticGetter; + _InjectedClass.staticMethod(42); + _InjectedClass.staticMethod; + var c = Class(42); + Class._injectedGenerative(42); + Class._injectedGenerative; + Class._injectedRedirecting(42); + Class._injectedRedirecting; + Class._injectedFactory(42); + Class._injectedFactory; + Class._injectedRedirectingFactory(42); + Class._injectedRedirectingFactory; + c._injectedInstanceSetter = c._injectedInstanceGetter; + c._injectedInstanceMethod(42); + c._injectedInstanceMethod; + Class._injectedStaticSetter = Class._injectedStaticGetter; + Class._injectedStaticMethod(42); + Class._injectedStaticMethod; + c._injectedExtensionInstanceSetter = c._injectedExtensionInstanceGetter; + c._injectedExtensionInstanceMethod(42); + c._injectedExtensionInstanceMethod; + Extension._injectedExtensionStaticSetter = + Extension._injectedExtensionStaticGetter; + Extension._injectedExtensionStaticMethod(42); + Extension._injectedExtensionStaticMethod; +} + +@patch +class Class { + @patch + Class(int value); + + Class._injectedGenerative(int value); + + @patch + Class.redirecting(int value) : this(value); + + Class._injectedRedirecting(int value) : this(value); + + @patch + factory Class.factory(int value) => Class(value); + + factory Class._injectedFactory(int value) => Class(value); + + @patch + factory Class.redirectingFactory(int value) = Class; + + factory Class._injectedRedirectingFactory(int value) = Class; + + @patch + int get instanceGetter => 42; + + int get _injectedInstanceGetter => 42; + + @patch + void set instanceSetter(int value) {} + + void set _injectedInstanceSetter(int value) {} + + @patch + void instanceMethod(int value) {} + + void _injectedInstanceMethod(int value) {} + + @patch + Class operator +(Class a) => this; + + @patch + static int get staticGetter => 42; + + static int get _injectedStaticGetter => 42; + + @patch + static void set staticSetter(int value) {} + + static void set _injectedStaticSetter(int value) {} + + @patch + static void staticMethod(int value) {} + + static void _injectedStaticMethod(int value) {} +} + +class _InjectedClass { + _InjectedClass(int value); + _InjectedClass.redirecting(int value) : this(value); + factory _InjectedClass.factory(int value) => _InjectedClass(value); + factory _InjectedClass.redirectingFactory(int value) = _InjectedClass; + int instanceField = 42; + int get instanceGetter => 42; + void set instanceSetter(int value) {} + void instanceMethod(int value) {} + static int staticField = 42; + static int get staticGetter => 42; + static void set staticSetter(int value) {} + static void staticMethod(int value) {} +} + +@patch +extension Extension on Class { + @patch + int get extensionInstanceGetter => 42; + + int get _injectedExtensionInstanceGetter => 42; + + @patch + void set extensionInstanceSetter(int value) {} + + void set _injectedExtensionInstanceSetter(int value) {} + + @patch + void extensionInstanceMethod(int value) {} + + void _injectedExtensionInstanceMethod(int value) {} + + @patch + Class operator -(Class a) => this; + + static int _injectedExtensionStaticField = 42; + + @patch + static int get extensionStaticGetter => 42; + + static int get _injectedExtensionStaticGetter => 42; + + @patch + static void set extensionStaticSetter(int value) {} + + static void set _injectedExtensionStaticSetter(int value) {} + + @patch + static void extensionStaticMethod(int value) {} + + static void _injectedExtensionStaticMethod(int value) {} +} diff --git a/pkg/front_end/testcases/general/platform_invalid_uris/main.dart.strong.expect b/pkg/front_end/testcases/general/platform_invalid_uris/main.dart.strong.expect index e7c754148a1..73ddd2f9c20 100644 --- a/pkg/front_end/testcases/general/platform_invalid_uris/main.dart.strong.expect +++ b/pkg/front_end/testcases/general/platform_invalid_uris/main.dart.strong.expect @@ -52,11 +52,11 @@ import self as test; import "dart:_internal" as _in; import "dart:core" as core; +import "org-dartlang-malformed-uri:?%3Aa"; +export "org-dartlang-malformed-uri:?%3Ab"; import "dart:_internal"; import "org-dartlang-malformed-uri:?%3Ac"; export "org-dartlang-malformed-uri:?%3Ad"; -import "org-dartlang-malformed-uri:?%3Aa"; -export "org-dartlang-malformed-uri:?%3Ab"; @/* from org-dartlang-testcase:///patch_lib.dart */ #C1 class Class extends core::Object { diff --git a/pkg/front_end/testcases/general/platform_invalid_uris/main.dart.strong.modular.expect b/pkg/front_end/testcases/general/platform_invalid_uris/main.dart.strong.modular.expect index e7c754148a1..73ddd2f9c20 100644 --- a/pkg/front_end/testcases/general/platform_invalid_uris/main.dart.strong.modular.expect +++ b/pkg/front_end/testcases/general/platform_invalid_uris/main.dart.strong.modular.expect @@ -52,11 +52,11 @@ import self as test; import "dart:_internal" as _in; import "dart:core" as core; +import "org-dartlang-malformed-uri:?%3Aa"; +export "org-dartlang-malformed-uri:?%3Ab"; import "dart:_internal"; import "org-dartlang-malformed-uri:?%3Ac"; export "org-dartlang-malformed-uri:?%3Ad"; -import "org-dartlang-malformed-uri:?%3Aa"; -export "org-dartlang-malformed-uri:?%3Ab"; @/* from org-dartlang-testcase:///patch_lib.dart */ #C1 class Class extends core::Object { diff --git a/pkg/front_end/testcases/general/platform_invalid_uris/main.dart.strong.outline.expect b/pkg/front_end/testcases/general/platform_invalid_uris/main.dart.strong.outline.expect index 36864cd6a63..8533509749a 100644 --- a/pkg/front_end/testcases/general/platform_invalid_uris/main.dart.strong.outline.expect +++ b/pkg/front_end/testcases/general/platform_invalid_uris/main.dart.strong.outline.expect @@ -50,11 +50,11 @@ import self as self2; import "dart:_internal" as _in; import "dart:core" as core; +import "org-dartlang-malformed-uri:?%3Aa"; +export "org-dartlang-malformed-uri:?%3Ab"; import "dart:_internal"; import "org-dartlang-malformed-uri:?%3Ac"; export "org-dartlang-malformed-uri:?%3Ad"; -import "org-dartlang-malformed-uri:?%3Aa"; -export "org-dartlang-malformed-uri:?%3Ab"; @/* from org-dartlang-testcase:///patch_lib.dart */ _in::patch class Class extends core::Object { diff --git a/pkg/front_end/testcases/general/platform_invalid_uris/main.dart.strong.transformed.expect b/pkg/front_end/testcases/general/platform_invalid_uris/main.dart.strong.transformed.expect index e7c754148a1..73ddd2f9c20 100644 --- a/pkg/front_end/testcases/general/platform_invalid_uris/main.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/general/platform_invalid_uris/main.dart.strong.transformed.expect @@ -52,11 +52,11 @@ import self as test; import "dart:_internal" as _in; import "dart:core" as core; +import "org-dartlang-malformed-uri:?%3Aa"; +export "org-dartlang-malformed-uri:?%3Ab"; import "dart:_internal"; import "org-dartlang-malformed-uri:?%3Ac"; export "org-dartlang-malformed-uri:?%3Ad"; -import "org-dartlang-malformed-uri:?%3Aa"; -export "org-dartlang-malformed-uri:?%3Ab"; @/* from org-dartlang-testcase:///patch_lib.dart */ #C1 class Class extends core::Object { diff --git a/pkg/front_end/testcases/nnbd/platform_definite_assignment/main.dart.strong.expect b/pkg/front_end/testcases/nnbd/platform_definite_assignment/main.dart.strong.expect index 982632b6a0f..8639a1e833b 100644 --- a/pkg/front_end/testcases/nnbd/platform_definite_assignment/main.dart.strong.expect +++ b/pkg/front_end/testcases/nnbd/platform_definite_assignment/main.dart.strong.expect @@ -13,6 +13,18 @@ library; // // Problems in library: // +// pkg/front_end/testcases/nnbd/platform_definite_assignment/origin_lib.dart:17:5: Error: Non-nullable variable 'k' must be assigned before it can be used. +// k; +// ^ +// +// pkg/front_end/testcases/nnbd/platform_definite_assignment/origin_lib.dart:25:12: Error: Non-nullable variable 'k' must be assigned before it can be used. +// return k; +// ^ +// +// pkg/front_end/testcases/nnbd/platform_definite_assignment/origin_lib.dart:34:10: Error: Non-nullable variable 'k' must be assigned before it can be used. +// return k; +// ^ +// // pkg/front_end/testcases/nnbd/platform_definite_assignment/patch_lib.dart:15:5: Error: Non-nullable variable 'k' must be assigned before it can be used. // k; // ^ @@ -33,18 +45,6 @@ library; // return k; // ^ // -// pkg/front_end/testcases/nnbd/platform_definite_assignment/origin_lib.dart:17:5: Error: Non-nullable variable 'k' must be assigned before it can be used. -// k; -// ^ -// -// pkg/front_end/testcases/nnbd/platform_definite_assignment/origin_lib.dart:25:12: Error: Non-nullable variable 'k' must be assigned before it can be used. -// return k; -// ^ -// -// pkg/front_end/testcases/nnbd/platform_definite_assignment/origin_lib.dart:34:10: Error: Non-nullable variable 'k' must be assigned before it can be used. -// return k; -// ^ -// import self as test; import "dart:_internal" as _in; import "dart:core" as core; diff --git a/pkg/front_end/testcases/nnbd/platform_definite_assignment/main.dart.strong.modular.expect b/pkg/front_end/testcases/nnbd/platform_definite_assignment/main.dart.strong.modular.expect index 982632b6a0f..8639a1e833b 100644 --- a/pkg/front_end/testcases/nnbd/platform_definite_assignment/main.dart.strong.modular.expect +++ b/pkg/front_end/testcases/nnbd/platform_definite_assignment/main.dart.strong.modular.expect @@ -13,6 +13,18 @@ library; // // Problems in library: // +// pkg/front_end/testcases/nnbd/platform_definite_assignment/origin_lib.dart:17:5: Error: Non-nullable variable 'k' must be assigned before it can be used. +// k; +// ^ +// +// pkg/front_end/testcases/nnbd/platform_definite_assignment/origin_lib.dart:25:12: Error: Non-nullable variable 'k' must be assigned before it can be used. +// return k; +// ^ +// +// pkg/front_end/testcases/nnbd/platform_definite_assignment/origin_lib.dart:34:10: Error: Non-nullable variable 'k' must be assigned before it can be used. +// return k; +// ^ +// // pkg/front_end/testcases/nnbd/platform_definite_assignment/patch_lib.dart:15:5: Error: Non-nullable variable 'k' must be assigned before it can be used. // k; // ^ @@ -33,18 +45,6 @@ library; // return k; // ^ // -// pkg/front_end/testcases/nnbd/platform_definite_assignment/origin_lib.dart:17:5: Error: Non-nullable variable 'k' must be assigned before it can be used. -// k; -// ^ -// -// pkg/front_end/testcases/nnbd/platform_definite_assignment/origin_lib.dart:25:12: Error: Non-nullable variable 'k' must be assigned before it can be used. -// return k; -// ^ -// -// pkg/front_end/testcases/nnbd/platform_definite_assignment/origin_lib.dart:34:10: Error: Non-nullable variable 'k' must be assigned before it can be used. -// return k; -// ^ -// import self as test; import "dart:_internal" as _in; import "dart:core" as core; diff --git a/pkg/front_end/testcases/nnbd/platform_definite_assignment/main.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/platform_definite_assignment/main.dart.strong.transformed.expect index 982632b6a0f..8639a1e833b 100644 --- a/pkg/front_end/testcases/nnbd/platform_definite_assignment/main.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/nnbd/platform_definite_assignment/main.dart.strong.transformed.expect @@ -13,6 +13,18 @@ library; // // Problems in library: // +// pkg/front_end/testcases/nnbd/platform_definite_assignment/origin_lib.dart:17:5: Error: Non-nullable variable 'k' must be assigned before it can be used. +// k; +// ^ +// +// pkg/front_end/testcases/nnbd/platform_definite_assignment/origin_lib.dart:25:12: Error: Non-nullable variable 'k' must be assigned before it can be used. +// return k; +// ^ +// +// pkg/front_end/testcases/nnbd/platform_definite_assignment/origin_lib.dart:34:10: Error: Non-nullable variable 'k' must be assigned before it can be used. +// return k; +// ^ +// // pkg/front_end/testcases/nnbd/platform_definite_assignment/patch_lib.dart:15:5: Error: Non-nullable variable 'k' must be assigned before it can be used. // k; // ^ @@ -33,18 +45,6 @@ library; // return k; // ^ // -// pkg/front_end/testcases/nnbd/platform_definite_assignment/origin_lib.dart:17:5: Error: Non-nullable variable 'k' must be assigned before it can be used. -// k; -// ^ -// -// pkg/front_end/testcases/nnbd/platform_definite_assignment/origin_lib.dart:25:12: Error: Non-nullable variable 'k' must be assigned before it can be used. -// return k; -// ^ -// -// pkg/front_end/testcases/nnbd/platform_definite_assignment/origin_lib.dart:34:10: Error: Non-nullable variable 'k' must be assigned before it can be used. -// return k; -// ^ -// import self as test; import "dart:_internal" as _in; import "dart:core" as core; diff --git a/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/libraries.json b/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/libraries.json index f89ef7ff0c7..79373ada6d4 100644 --- a/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/libraries.json +++ b/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/libraries.json @@ -4,8 +4,7 @@ "libraries": { "test": { "patches": [ - "patch_lib.dart", - "patch_lib2.dart" + "patch_lib.dart" ], "uri": "origin_lib.dart" } diff --git a/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/main.dart.strong.expect b/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/main.dart.strong.expect index c61d853c62d..3ef6b9ea44d 100644 --- a/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/main.dart.strong.expect +++ b/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/main.dart.strong.expect @@ -46,12 +46,12 @@ class Class1 extends core::Object { @/* from org-dartlang-testcase:///patch_lib2.dart */ #C1 class Class2 extends core::Object { field core::int _field /* from org-dartlang-testcase:///patch_lib2.dart */; - constructor /* from org-dartlang-testcase:///patch_lib2.dart */ constructor2(core::int _field) → test::Class2 - : test::Class2::_field = _field, super core::Object::•() - ; constructor constructor1() → test::Class2 : test::Class2::_field = null, super core::Object::•() ; + constructor /* from org-dartlang-testcase:///patch_lib2.dart */ constructor2(core::int _field) → test::Class2 + : test::Class2::_field = _field, super core::Object::•() + ; } constants { diff --git a/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/main.dart.strong.modular.expect b/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/main.dart.strong.modular.expect index c61d853c62d..3ef6b9ea44d 100644 --- a/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/main.dart.strong.modular.expect +++ b/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/main.dart.strong.modular.expect @@ -46,12 +46,12 @@ class Class1 extends core::Object { @/* from org-dartlang-testcase:///patch_lib2.dart */ #C1 class Class2 extends core::Object { field core::int _field /* from org-dartlang-testcase:///patch_lib2.dart */; - constructor /* from org-dartlang-testcase:///patch_lib2.dart */ constructor2(core::int _field) → test::Class2 - : test::Class2::_field = _field, super core::Object::•() - ; constructor constructor1() → test::Class2 : test::Class2::_field = null, super core::Object::•() ; + constructor /* from org-dartlang-testcase:///patch_lib2.dart */ constructor2(core::int _field) → test::Class2 + : test::Class2::_field = _field, super core::Object::•() + ; } constants { diff --git a/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/main.dart.strong.outline.expect b/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/main.dart.strong.outline.expect index f46b90bed51..0b96489f92b 100644 --- a/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/main.dart.strong.outline.expect +++ b/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/main.dart.strong.outline.expect @@ -31,10 +31,10 @@ class Class1 extends core::Object { @/* from org-dartlang-testcase:///patch_lib2.dart */ _in::patch class Class2 extends core::Object { field core::int _field /* from org-dartlang-testcase:///patch_lib2.dart */; - constructor /* from org-dartlang-testcase:///patch_lib2.dart */ constructor2(core::int _field) → self2::Class2 - ; constructor constructor1() → self2::Class2 ; + constructor /* from org-dartlang-testcase:///patch_lib2.dart */ constructor2(core::int _field) → self2::Class2 + ; } diff --git a/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/main.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/main.dart.strong.transformed.expect index c61d853c62d..3ef6b9ea44d 100644 --- a/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/main.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/main.dart.strong.transformed.expect @@ -46,12 +46,12 @@ class Class1 extends core::Object { @/* from org-dartlang-testcase:///patch_lib2.dart */ #C1 class Class2 extends core::Object { field core::int _field /* from org-dartlang-testcase:///patch_lib2.dart */; - constructor /* from org-dartlang-testcase:///patch_lib2.dart */ constructor2(core::int _field) → test::Class2 - : test::Class2::_field = _field, super core::Object::•() - ; constructor constructor1() → test::Class2 : test::Class2::_field = null, super core::Object::•() ; + constructor /* from org-dartlang-testcase:///patch_lib2.dart */ constructor2(core::int _field) → test::Class2 + : test::Class2::_field = _field, super core::Object::•() + ; } constants { diff --git a/pkg/front_end/testcases/nnbd/platform_optional_parameters/main.dart.strong.expect b/pkg/front_end/testcases/nnbd/platform_optional_parameters/main.dart.strong.expect index ab03b8e9c62..b798b46411b 100644 --- a/pkg/front_end/testcases/nnbd/platform_optional_parameters/main.dart.strong.expect +++ b/pkg/front_end/testcases/nnbd/platform_optional_parameters/main.dart.strong.expect @@ -22,16 +22,6 @@ library; // void patchedMethod([int i]) {} // ^ // -// pkg/front_end/testcases/nnbd/platform_optional_parameters/patch_lib.dart:17:25: Error: The parameter 'i' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'. -// Try adding either an explicit non-'null' default value or the 'required' modifier. -// void patchedMethod([int i]) {} -// ^ -// -// pkg/front_end/testcases/nnbd/platform_optional_parameters/patch_lib.dart:19:27: Error: The parameter 'i' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'. -// Try adding either an explicit non-'null' default value or the 'required' modifier. -// void _injectedMethod([int i]) {} -// ^ -// // pkg/front_end/testcases/nnbd/platform_optional_parameters/patch_lib.dart:13:29: Error: The parameter 'i' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'. // Try adding either an explicit non-'null' default value or the 'required' modifier. // void _injectedMethod([int i]) {} @@ -42,6 +32,16 @@ library; // void method([int i]) {} // ^ // +// pkg/front_end/testcases/nnbd/platform_optional_parameters/patch_lib.dart:17:25: Error: The parameter 'i' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'. +// Try adding either an explicit non-'null' default value or the 'required' modifier. +// void patchedMethod([int i]) {} +// ^ +// +// pkg/front_end/testcases/nnbd/platform_optional_parameters/patch_lib.dart:19:27: Error: The parameter 'i' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'. +// Try adding either an explicit non-'null' default value or the 'required' modifier. +// void _injectedMethod([int i]) {} +// ^ +// import self as test; import "dart:_internal" as _in; import "dart:core" as core; diff --git a/pkg/front_end/testcases/nnbd/platform_optional_parameters/main.dart.strong.modular.expect b/pkg/front_end/testcases/nnbd/platform_optional_parameters/main.dart.strong.modular.expect index ab03b8e9c62..b798b46411b 100644 --- a/pkg/front_end/testcases/nnbd/platform_optional_parameters/main.dart.strong.modular.expect +++ b/pkg/front_end/testcases/nnbd/platform_optional_parameters/main.dart.strong.modular.expect @@ -22,16 +22,6 @@ library; // void patchedMethod([int i]) {} // ^ // -// pkg/front_end/testcases/nnbd/platform_optional_parameters/patch_lib.dart:17:25: Error: The parameter 'i' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'. -// Try adding either an explicit non-'null' default value or the 'required' modifier. -// void patchedMethod([int i]) {} -// ^ -// -// pkg/front_end/testcases/nnbd/platform_optional_parameters/patch_lib.dart:19:27: Error: The parameter 'i' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'. -// Try adding either an explicit non-'null' default value or the 'required' modifier. -// void _injectedMethod([int i]) {} -// ^ -// // pkg/front_end/testcases/nnbd/platform_optional_parameters/patch_lib.dart:13:29: Error: The parameter 'i' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'. // Try adding either an explicit non-'null' default value or the 'required' modifier. // void _injectedMethod([int i]) {} @@ -42,6 +32,16 @@ library; // void method([int i]) {} // ^ // +// pkg/front_end/testcases/nnbd/platform_optional_parameters/patch_lib.dart:17:25: Error: The parameter 'i' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'. +// Try adding either an explicit non-'null' default value or the 'required' modifier. +// void patchedMethod([int i]) {} +// ^ +// +// pkg/front_end/testcases/nnbd/platform_optional_parameters/patch_lib.dart:19:27: Error: The parameter 'i' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'. +// Try adding either an explicit non-'null' default value or the 'required' modifier. +// void _injectedMethod([int i]) {} +// ^ +// import self as test; import "dart:_internal" as _in; import "dart:core" as core; diff --git a/pkg/front_end/testcases/nnbd/platform_optional_parameters/main.dart.strong.outline.expect b/pkg/front_end/testcases/nnbd/platform_optional_parameters/main.dart.strong.outline.expect index c234da43433..30b87a57cb1 100644 --- a/pkg/front_end/testcases/nnbd/platform_optional_parameters/main.dart.strong.outline.expect +++ b/pkg/front_end/testcases/nnbd/platform_optional_parameters/main.dart.strong.outline.expect @@ -20,16 +20,6 @@ library; // void patchedMethod([int i]) {} // ^ // -// pkg/front_end/testcases/nnbd/platform_optional_parameters/patch_lib.dart:17:25: Error: The parameter 'i' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'. -// Try adding either an explicit non-'null' default value or the 'required' modifier. -// void patchedMethod([int i]) {} -// ^ -// -// pkg/front_end/testcases/nnbd/platform_optional_parameters/patch_lib.dart:19:27: Error: The parameter 'i' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'. -// Try adding either an explicit non-'null' default value or the 'required' modifier. -// void _injectedMethod([int i]) {} -// ^ -// // pkg/front_end/testcases/nnbd/platform_optional_parameters/patch_lib.dart:13:29: Error: The parameter 'i' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'. // Try adding either an explicit non-'null' default value or the 'required' modifier. // void _injectedMethod([int i]) {} @@ -40,6 +30,16 @@ library; // void method([int i]) {} // ^ // +// pkg/front_end/testcases/nnbd/platform_optional_parameters/patch_lib.dart:17:25: Error: The parameter 'i' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'. +// Try adding either an explicit non-'null' default value or the 'required' modifier. +// void patchedMethod([int i]) {} +// ^ +// +// pkg/front_end/testcases/nnbd/platform_optional_parameters/patch_lib.dart:19:27: Error: The parameter 'i' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'. +// Try adding either an explicit non-'null' default value or the 'required' modifier. +// void _injectedMethod([int i]) {} +// ^ +// import self as self2; import "dart:_internal" as _in; import "dart:core" as core; diff --git a/pkg/front_end/testcases/nnbd/platform_optional_parameters/main.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/platform_optional_parameters/main.dart.strong.transformed.expect index ab03b8e9c62..b798b46411b 100644 --- a/pkg/front_end/testcases/nnbd/platform_optional_parameters/main.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/nnbd/platform_optional_parameters/main.dart.strong.transformed.expect @@ -22,16 +22,6 @@ library; // void patchedMethod([int i]) {} // ^ // -// pkg/front_end/testcases/nnbd/platform_optional_parameters/patch_lib.dart:17:25: Error: The parameter 'i' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'. -// Try adding either an explicit non-'null' default value or the 'required' modifier. -// void patchedMethod([int i]) {} -// ^ -// -// pkg/front_end/testcases/nnbd/platform_optional_parameters/patch_lib.dart:19:27: Error: The parameter 'i' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'. -// Try adding either an explicit non-'null' default value or the 'required' modifier. -// void _injectedMethod([int i]) {} -// ^ -// // pkg/front_end/testcases/nnbd/platform_optional_parameters/patch_lib.dart:13:29: Error: The parameter 'i' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'. // Try adding either an explicit non-'null' default value or the 'required' modifier. // void _injectedMethod([int i]) {} @@ -42,6 +32,16 @@ library; // void method([int i]) {} // ^ // +// pkg/front_end/testcases/nnbd/platform_optional_parameters/patch_lib.dart:17:25: Error: The parameter 'i' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'. +// Try adding either an explicit non-'null' default value or the 'required' modifier. +// void patchedMethod([int i]) {} +// ^ +// +// pkg/front_end/testcases/nnbd/platform_optional_parameters/patch_lib.dart:19:27: Error: The parameter 'i' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'. +// Try adding either an explicit non-'null' default value or the 'required' modifier. +// void _injectedMethod([int i]) {} +// ^ +// import self as test; import "dart:_internal" as _in; import "dart:core" as core; diff --git a/pkg/front_end/testcases/strong.status b/pkg/front_end/testcases/strong.status index 57373f4127e..769106e3f30 100644 --- a/pkg/front_end/testcases/strong.status +++ b/pkg/front_end/testcases/strong.status @@ -99,11 +99,14 @@ general/issue45101/main: SemiFuzzFailure general/mixin_from_patch/main: SemiFuzzFailure general/multiple_class_patches/main: SemiFuzzFailure general/nested_lib_spec/main: SemiFuzzFailure +general/patching/main: SemiFuzzFailure general/patch_annotations/main: SemiFuzzFailure general/patch_conflict/main: SemiFuzzFailure general/patch_extends_implements/main: SemiFuzzFailure general/patch_extension_scope/main: SemiFuzzFailure general/patch_getter/main: SemiFuzzFailure +general/patch_prefix_access/main: SemiFuzzFailure +general/patch_type_parameters/main: SemiFuzzFailure general/tear_off_patch/main: SemiFuzzFailure late_lowering/injected_late_field_checks/main: SemiFuzzFailure late_lowering/issue41436/issue41436: SemiFuzzFailure