diff --git a/pkg/front_end/lib/src/fragment/extension.dart b/pkg/front_end/lib/src/fragment/extension.dart index 475e111531a..88a751083c3 100644 --- a/pkg/front_end/lib/src/fragment/extension.dart +++ b/pkg/front_end/lib/src/fragment/extension.dart @@ -36,6 +36,8 @@ class ExtensionFragment extends DeclarationFragment implements Fragment { ? new FixedExtensionName(name) : new UnnamedExtensionName(); + bool get isUnnamed => extensionName.isUnnamedExtension; + @override SourceExtensionBuilder get builder { assert(_builder != null, "Builder has not been computed for $this."); diff --git a/pkg/front_end/lib/src/fragment/field.dart b/pkg/front_end/lib/src/fragment/field.dart index fdadbb9d71e..1737fd74aef 100644 --- a/pkg/front_end/lib/src/fragment/field.dart +++ b/pkg/front_end/lib/src/fragment/field.dart @@ -34,6 +34,19 @@ class FieldFragment implements Fragment { : _initializerToken = initializerToken, _constInitializerToken = constInitializerToken; + // Coverage-ignore(suite): Not run. + bool get hasSetter { + if (modifiers.isFinal) { + if (modifiers.isLate) { + return !modifiers.hasInitializer; + } else { + return false; + } + } else { + return true; + } + } + Token? get initializerToken { Token? result = _initializerToken; // Ensure that we don't hold onto the token. diff --git a/pkg/front_end/lib/src/fragment/util.dart b/pkg/front_end/lib/src/fragment/util.dart index a2969664d96..63044726d62 100644 --- a/pkg/front_end/lib/src/fragment/util.dart +++ b/pkg/front_end/lib/src/fragment/util.dart @@ -15,14 +15,23 @@ class ConstructorName { final int? nameOffset; /// The name of the constructor including the enclosing declaration name. + /// + /// For unnamed constructors the full name is normalized to be the class name, + /// regardless of whether the constructor was declared with 'new'. + /// + /// For invalid constructor names, the full name is normalized to use the + /// class name as prefix, regardless of whether the declaration did so. + /// + /// This means that not in all cases is the text pointed to by + /// [fullNameOffset] and [fullNameLength] the same as the [fullName]. final String fullName; - /// The offset at which [fullName] occurs. + /// The offset at which the full name occurs. /// /// This is used in messages to put the `^` at the start of the [fullName]. final int fullNameOffset; - /// The number of characters of [fullName] that occurs at [fullNameOffset]. + /// The number of characters of full name that occurs at [fullNameOffset]. /// /// This is used in messages to put the right amount of `^` under the name. final int fullNameLength; @@ -32,5 +41,6 @@ class ConstructorName { required this.nameOffset, required this.fullName, required this.fullNameOffset, - required this.fullNameLength}); + required this.fullNameLength}) + : assert(name != 'new'); } 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 319a27dfdc6..7dd362a70c5 100644 --- a/pkg/front_end/lib/src/source/source_builder_factory.dart +++ b/pkg/front_end/lib/src/source/source_builder_factory.dart @@ -1871,13 +1871,20 @@ class BuilderFactoryImpl implements BuilderFactory, BuilderFactoryResult { suffix = identifier.name; suffixOffset = identifier.nameOffset; charOffset = qualifier.nameOffset; - fullName = '${prefix}.${suffix}'; + String prefixAndSuffix = '${prefix}.${suffix}'; fullNameOffset = qualifier.nameOffset; // If the there is no space between the prefix and suffix we use the full // length as the name length. Otherwise the full name has no length. fullNameLength = fullNameOffset + prefix.length + 1 == suffixOffset - ? fullName.length + ? prefixAndSuffix.length : noLength; + if (suffix == "new") { + // Normalize `Class.new` to `Class`. + suffix = ''; + fullName = className; + } else { + fullName = '$className.$suffix'; + } } else { prefix = identifier.name; suffix = null; @@ -1887,9 +1894,7 @@ class BuilderFactoryImpl implements BuilderFactory, BuilderFactoryResult { fullNameOffset = identifier.nameOffset; fullNameLength = prefix.length; } - if (libraryFeatures.constructorTearoffs.isEnabled) { - suffix = suffix == "new" ? "" : suffix; - } + if (prefix == className) { return new ConstructorName( name: suffix ?? '', @@ -1897,6 +1902,9 @@ class BuilderFactoryImpl implements BuilderFactory, BuilderFactoryResult { fullName: fullName, fullNameOffset: fullNameOffset, fullNameLength: fullNameLength); + } else if (suffix == null) { + // Normalize `foo` in `Class` to `Class.foo`. + fullName = '$className.$prefix'; } if (suffix == null && !isFactory) { // This method is called because the syntax indicated that this is a @@ -1921,9 +1929,9 @@ class BuilderFactoryImpl implements BuilderFactory, BuilderFactoryResult { return new ConstructorName( name: suffix ?? prefix, nameOffset: suffixOffset, - fullName: suffix ?? prefix, + fullName: fullName, fullNameOffset: fullNameOffset, - fullNameLength: noLength); + fullNameLength: fullNameLength); } void _addNativeGetterFragment(GetterFragment fragment) { diff --git a/pkg/front_end/lib/src/source/source_field_builder.dart b/pkg/front_end/lib/src/source/source_field_builder.dart index 26823128d31..d91005458b1 100644 --- a/pkg/front_end/lib/src/source/source_field_builder.dart +++ b/pkg/front_end/lib/src/source/source_field_builder.dart @@ -154,14 +154,8 @@ class SourceFieldBuilder extends SourceMemberBuilderImpl assert(lateIsSetSetterReference == null); assert(lateGetterReference == null); assert(lateSetterReference == null); - _fieldEncoding = new RepresentationFieldEncoding( - this, - name, - nameScheme, - fileUri, - nameOffset, - endOffset, - fieldGetterReference); + _fieldEncoding = new RepresentationFieldEncoding(this, name, nameScheme, + fileUri, nameOffset, endOffset, fieldGetterReference); } else if (isLate && libraryBuilder.loader.target.backendTarget.isLateFieldLoweringEnabled( hasInitializer: hasInitializer, 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 b66ec1209ac..aa32e32a087 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 @@ -31,6 +31,21 @@ import 'source_loader.dart'; import 'source_procedure_builder.dart'; import 'source_type_alias_builder.dart'; +class _FragmentName { + final Uri fileUri; + final String name; + final int nameOffset; + final int nameLength; + final bool isAugment; + + _FragmentName( + {required this.fileUri, + required this.name, + required this.nameOffset, + required this.nameLength, + required this.isAugment}); +} + void _computeBuildersFromFragments(String name, List fragments, {required ProblemReporting problemReporting, required SourceLoader loader, @@ -43,6 +58,230 @@ void _computeBuildersFromFragments(String name, List fragments, required ContainerType containerType, IndexedContainer? indexedContainer, ContainerName? containerName}) { + // TODO(johnniwinther): Collect introductory and augmenting fragments. + _FragmentName? existingGetable; + _FragmentName? existingSetable; + _FragmentName? existingConstructor; + + void checkGetable(_FragmentName fragmentName) { + if (fragmentName.isAugment) { + // TODO(johnniwinther): Check that an introductory fragment exists and + // collect augmentations. + return; + } + if (existingGetable != null) { + problemReporting.addProblem( + templateDuplicatedDeclaration.withArguments(fragmentName.name), + fragmentName.nameOffset, + fragmentName.nameLength, + fragmentName.fileUri, + context: [ + templateDuplicatedDeclarationCause + .withArguments(existingGetable!.name) + .withLocation(existingGetable!.fileUri, + existingGetable!.nameOffset, existingGetable!.nameLength) + ]); + } + // TODO(johnniwinther): Check for conflict with setters. + /*else if (existingSetable != null) { + problemReporting.addProblem( + templateDuplicatedDeclaration.withArguments(fragmentName.name), + fragmentName.nameOffset, + fragmentName.nameLength, + fragmentName.fileUri, + context: [ + templateDuplicatedDeclarationCause + .withArguments(existingSetable!.name) + .withLocation(existingSetable!.fileUri, + existingSetable!.nameOffset, existingSetable!.nameLength) + ]); + }*/ + existingGetable = fragmentName; + } + + void checkProperty({_FragmentName? getable, _FragmentName? setable}) { + if (getable != null && existingGetable != null) { + if (getable.isAugment) { + // Check that an introductory fragment exists and collect augmentations. + getable = null; + } else { + problemReporting.addProblem( + templateDuplicatedDeclaration.withArguments(getable.name), + getable.nameOffset, + getable.nameLength, + getable.fileUri, + context: [ + templateDuplicatedDeclarationCause + .withArguments(existingGetable!.name) + .withLocation(existingGetable!.fileUri, + existingGetable!.nameOffset, existingGetable!.nameLength) + ]); + } + } else if (setable != null && existingSetable != null) { + if (setable.isAugment) { + // TODO(johnniwinther): Check that an introductory fragment exists and + // collect augmentations. + setable = null; + } else { + problemReporting.addProblem( + templateDuplicatedDeclaration.withArguments(setable.name), + setable.nameOffset, + setable.nameLength, + setable.fileUri, + context: [ + templateDuplicatedDeclarationCause + .withArguments(existingSetable!.name) + .withLocation(existingSetable!.fileUri, + existingSetable!.nameOffset, existingSetable!.nameLength) + ]); + } + } + if (getable != null) { + existingGetable = getable; + } + if (setable != null) { + existingSetable = setable; + } + } + + void checkConstructor(_FragmentName constructor) { + if (constructor.isAugment) { + // TODO(johnniwinther): Check that an introductory fragment exists and + // collect augmentations. + return; + } + if (existingConstructor != null) { + problemReporting.addProblem( + templateDuplicatedDeclaration.withArguments(constructor.name), + constructor.nameOffset, + constructor.nameLength, + constructor.fileUri, + context: [ + templateDuplicatedDeclarationCause + .withArguments(existingConstructor!.name) + .withLocation( + existingConstructor!.fileUri, + existingConstructor!.nameOffset, + existingConstructor!.nameLength) + ]); + } + existingConstructor = constructor; + } + + for (Fragment fragment in fragments) { + switch (fragment) { + case ClassFragment(): + checkGetable(new _FragmentName( + fileUri: fragment.fileUri, + name: fragment.name, + nameOffset: fragment.nameOffset, + nameLength: fragment.name.length, + isAugment: fragment.modifiers.isAugment)); + case EnumFragment(): + checkGetable(new _FragmentName( + fileUri: fragment.fileUri, + name: fragment.name, + nameOffset: fragment.nameOffset, + nameLength: fragment.name.length, + // TODO(johnniwinther): Support enum augmentations. + isAugment: false)); + case ExtensionTypeFragment(): + checkGetable(new _FragmentName( + fileUri: fragment.fileUri, + name: fragment.name, + nameOffset: fragment.nameOffset, + nameLength: fragment.name.length, + isAugment: fragment.modifiers.isAugment)); + case MethodFragment(): + checkGetable(new _FragmentName( + fileUri: fragment.fileUri, + name: fragment.name, + nameOffset: fragment.nameOffset, + nameLength: fragment.name.length, + isAugment: fragment.modifiers.isAugment)); + case MixinFragment(): + checkGetable(new _FragmentName( + fileUri: fragment.fileUri, + name: fragment.name, + nameOffset: fragment.nameOffset, + nameLength: fragment.name.length, + isAugment: fragment.modifiers.isAugment)); + case NamedMixinApplicationFragment(): + checkGetable(new _FragmentName( + fileUri: fragment.fileUri, + name: fragment.name, + nameOffset: fragment.nameOffset, + nameLength: fragment.name.length, + isAugment: fragment.modifiers.isAugment)); + case TypedefFragment(): + checkGetable(new _FragmentName( + fileUri: fragment.fileUri, + name: fragment.name, + nameOffset: fragment.nameOffset, + nameLength: fragment.name.length, + // TODO(johnniwinther): Support typedef augmentations. + isAugment: false)); + case ExtensionFragment(): + if (!fragment.isUnnamed) { + checkGetable(new _FragmentName( + fileUri: fragment.fileUri, + name: fragment.name, + nameOffset: fragment.fileOffset, + nameLength: fragment.name.length, + isAugment: fragment.modifiers.isAugment)); + } + // TODO(johnniwinther): + case FactoryFragment(): + checkConstructor(new _FragmentName( + fileUri: fragment.fileUri, + name: fragment.constructorName.fullName, + nameOffset: fragment.constructorName.fullNameOffset, + nameLength: fragment.constructorName.fullNameLength, + isAugment: fragment.modifiers.isAugment)); + case ConstructorFragment(): + checkConstructor(new _FragmentName( + fileUri: fragment.fileUri, + name: fragment.constructorName.fullName, + nameOffset: fragment.constructorName.fullNameOffset, + nameLength: fragment.constructorName.fullNameLength, + isAugment: fragment.modifiers.isAugment)); + case PrimaryConstructorFragment(): + checkConstructor(new _FragmentName( + fileUri: fragment.fileUri, + name: fragment.constructorName.fullName, + nameOffset: fragment.constructorName.fullNameOffset, + nameLength: fragment.constructorName.fullNameLength, + isAugment: fragment.modifiers.isAugment)); + case FieldFragment(): + _FragmentName fragmentName = new _FragmentName( + fileUri: fragment.fileUri, + name: fragment.name, + nameOffset: fragment.nameOffset, + nameLength: fragment.name.length, + isAugment: fragment.modifiers.isAugment); + checkProperty(getable: fragmentName + // TODO(johnniwinther): Check getter/setter conflict here. + /*, setable: fragment.hasSetter ? fragmentName : null*/ + ); + case GetterFragment(): + _FragmentName fragmentName = new _FragmentName( + fileUri: fragment.fileUri, + name: fragment.name, + nameOffset: fragment.nameOffset, + nameLength: fragment.name.length, + isAugment: fragment.modifiers.isAugment); + checkProperty(getable: fragmentName); + case SetterFragment(): + _FragmentName fragmentName = new _FragmentName( + fileUri: fragment.fileUri, + name: fragment.name, + nameOffset: fragment.nameOffset, + nameLength: fragment.name.length, + isAugment: fragment.modifiers.isAugment); + checkProperty(setable: fragmentName); + } + } + for (Fragment fragment in fragments) { switch (fragment) { case TypedefFragment(): @@ -924,18 +1163,8 @@ class LibraryNameSpaceBuilder { } declaration.next = existing; if (isDuplicatedDeclaration(existing, declaration)) { - String fullName = name; - problemReporting.addProblem( - templateDuplicatedDeclaration.withArguments(fullName), - charOffset, - fullName.length, - declaration.fileUri!, - context: [ - templateDuplicatedDeclarationCause - .withArguments(fullName) - .withLocation( - existing!.fileUri!, existing.fileOffset, fullName.length) - ]); + // Error reporting in [_computeBuildersFromFragments]. + // TODO(johnniwinther): Avoid the use of [isDuplicatedDeclaration]. } else if (declaration.isExtension) { // We add the extension declaration to the extension scope only if its // name is unique. Only the first of duplicate extensions is accessible @@ -1139,25 +1368,8 @@ class DeclarationNameSpaceBuilder { } declaration.next = existing; if (isDuplicatedDeclaration(existing, declaration)) { - String fullName = name; - if (isConstructor) { - if (name.isEmpty) { - fullName = _name; - } else { - fullName = "${_name}.$name"; - } - } - problemReporting.addProblem( - templateDuplicatedDeclaration.withArguments(fullName), - charOffset, - fullName.length, - declaration.fileUri!, - context: [ - templateDuplicatedDeclarationCause - .withArguments(fullName) - .withLocation( - existing!.fileUri!, existing.fileOffset, fullName.length) - ]); + // Error reporting in [_computeBuildersFromFragments]. + // TODO(johnniwinther): Avoid the use of [isDuplicatedDeclaration]. } else if (declaration.isAugment) { // Coverage-ignore-block(suite): Not run. if (existing != null) { diff --git a/pkg/front_end/test/coverage_suite_expected.dart b/pkg/front_end/test/coverage_suite_expected.dart index 6b970a16289..2f65faee1e7 100644 --- a/pkg/front_end/test/coverage_suite_expected.dart +++ b/pkg/front_end/test/coverage_suite_expected.dart @@ -480,7 +480,7 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/fragment/constructor.dart": ( - hitCount: 44, + hitCount: 50, missCount: 0, ), // 100.0%. @@ -490,7 +490,7 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/fragment/extension.dart": ( - hitCount: 19, + hitCount: 22, missCount: 0, ), // 100.0%. @@ -500,7 +500,7 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/fragment/factory.dart": ( - hitCount: 34, + hitCount: 40, missCount: 0, ), // 100.0%. @@ -530,7 +530,7 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/fragment/primary_constructor.dart": ( - hitCount: 43, + hitCount: 47, missCount: 0, ), // 100.0%. @@ -544,6 +544,11 @@ const Map _expect = { missCount: 0, ), // 100.0%. + "package:front_end/src/fragment/util.dart": ( + hitCount: 3, + missCount: 0, + ), + // 100.0%. "package:front_end/src/kernel/augmentation_lowering.dart": ( hitCount: 4, missCount: 0, @@ -865,7 +870,7 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/source/outline_builder.dart": ( - hitCount: 2119, + hitCount: 2118, missCount: 0, ), // 100.0%. @@ -875,7 +880,7 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/source/source_builder_factory.dart": ( - hitCount: 1275, + hitCount: 1295, missCount: 0, ), // 100.0%. @@ -921,7 +926,7 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/source/source_field_builder.dart": ( - hitCount: 1247, + hitCount: 1245, missCount: 0, ), // 100.0%. @@ -961,7 +966,7 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/source/type_parameter_scope_builder.dart": ( - hitCount: 786, + hitCount: 991, missCount: 0, ), // 100.0%. @@ -996,7 +1001,7 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/type_inference/inference_visitor.dart": ( - hitCount: 8246, + hitCount: 8249, missCount: 0, ), // 100.0%. diff --git a/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.strong.expect b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.strong.expect index 97c8379ee4c..9ed6d6b178f 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.strong.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.strong.expect @@ -4,7 +4,7 @@ library; // // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:15:3: Error: 'C' is already declared in this scope. // C.new(); // Error. -// ^ +// ^^^^^ // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:14:3: Context: Previous declaration of 'C'. // C(); // ^ @@ -14,11 +14,11 @@ library; // ^ // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:19:3: Context: Previous declaration of 'D'. // D.new(); -// ^ +// ^^^^^ // // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:26:11: Error: 'E1' is already declared in this scope. // factory E1.new() => E1._(); // Error. -// ^^ +// ^^^^^^ // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:25:3: Context: Previous declaration of 'E1'. // E1(); // ^^ @@ -28,11 +28,11 @@ library; // ^^ // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:31:11: Context: Previous declaration of 'E2'. // factory E2.new() => E2._(); -// ^^ +// ^^^^^^ // // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:38:11: Error: 'E3' is already declared in this scope. // factory E3.new() = E3._; // Error. -// ^^ +// ^^^^^^ // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:37:3: Context: Previous declaration of 'E3'. // E3(); // ^^ @@ -42,7 +42,7 @@ library; // ^^ // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:43:11: Context: Previous declaration of 'E4'. // factory E4.new() = E4._; -// ^^ +// ^^^^^^ // import self as self; import "dart:core" as core; diff --git a/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.strong.modular.expect b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.strong.modular.expect index 97c8379ee4c..9ed6d6b178f 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.strong.modular.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.strong.modular.expect @@ -4,7 +4,7 @@ library; // // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:15:3: Error: 'C' is already declared in this scope. // C.new(); // Error. -// ^ +// ^^^^^ // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:14:3: Context: Previous declaration of 'C'. // C(); // ^ @@ -14,11 +14,11 @@ library; // ^ // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:19:3: Context: Previous declaration of 'D'. // D.new(); -// ^ +// ^^^^^ // // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:26:11: Error: 'E1' is already declared in this scope. // factory E1.new() => E1._(); // Error. -// ^^ +// ^^^^^^ // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:25:3: Context: Previous declaration of 'E1'. // E1(); // ^^ @@ -28,11 +28,11 @@ library; // ^^ // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:31:11: Context: Previous declaration of 'E2'. // factory E2.new() => E2._(); -// ^^ +// ^^^^^^ // // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:38:11: Error: 'E3' is already declared in this scope. // factory E3.new() = E3._; // Error. -// ^^ +// ^^^^^^ // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:37:3: Context: Previous declaration of 'E3'. // E3(); // ^^ @@ -42,7 +42,7 @@ library; // ^^ // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:43:11: Context: Previous declaration of 'E4'. // factory E4.new() = E4._; -// ^^ +// ^^^^^^ // import self as self; import "dart:core" as core; diff --git a/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.strong.outline.expect b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.strong.outline.expect index b8008f9098b..9cd9052f401 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.strong.outline.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.strong.outline.expect @@ -4,7 +4,7 @@ library; // // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:15:3: Error: 'C' is already declared in this scope. // C.new(); // Error. -// ^ +// ^^^^^ // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:14:3: Context: Previous declaration of 'C'. // C(); // ^ @@ -14,11 +14,11 @@ library; // ^ // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:19:3: Context: Previous declaration of 'D'. // D.new(); -// ^ +// ^^^^^ // // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:26:11: Error: 'E1' is already declared in this scope. // factory E1.new() => E1._(); // Error. -// ^^ +// ^^^^^^ // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:25:3: Context: Previous declaration of 'E1'. // E1(); // ^^ @@ -28,11 +28,11 @@ library; // ^^ // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:31:11: Context: Previous declaration of 'E2'. // factory E2.new() => E2._(); -// ^^ +// ^^^^^^ // // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:38:11: Error: 'E3' is already declared in this scope. // factory E3.new() = E3._; // Error. -// ^^ +// ^^^^^^ // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:37:3: Context: Previous declaration of 'E3'. // E3(); // ^^ @@ -42,7 +42,7 @@ library; // ^^ // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:43:11: Context: Previous declaration of 'E4'. // factory E4.new() = E4._; -// ^^ +// ^^^^^^ // import self as self; import "dart:core" as core; diff --git a/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.strong.transformed.expect b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.strong.transformed.expect index 97c8379ee4c..9ed6d6b178f 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.strong.transformed.expect @@ -4,7 +4,7 @@ library; // // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:15:3: Error: 'C' is already declared in this scope. // C.new(); // Error. -// ^ +// ^^^^^ // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:14:3: Context: Previous declaration of 'C'. // C(); // ^ @@ -14,11 +14,11 @@ library; // ^ // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:19:3: Context: Previous declaration of 'D'. // D.new(); -// ^ +// ^^^^^ // // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:26:11: Error: 'E1' is already declared in this scope. // factory E1.new() => E1._(); // Error. -// ^^ +// ^^^^^^ // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:25:3: Context: Previous declaration of 'E1'. // E1(); // ^^ @@ -28,11 +28,11 @@ library; // ^^ // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:31:11: Context: Previous declaration of 'E2'. // factory E2.new() => E2._(); -// ^^ +// ^^^^^^ // // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:38:11: Error: 'E3' is already declared in this scope. // factory E3.new() = E3._; // Error. -// ^^ +// ^^^^^^ // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:37:3: Context: Previous declaration of 'E3'. // E3(); // ^^ @@ -42,7 +42,7 @@ library; // ^^ // pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:43:11: Context: Previous declaration of 'E4'. // factory E4.new() = E4._; -// ^^ +// ^^^^^^ // import self as self; import "dart:core" as core; diff --git a/pkg/front_end/testcases/extension_types/duplicate_constructors.dart.strong.expect b/pkg/front_end/testcases/extension_types/duplicate_constructors.dart.strong.expect index e3b8c3df803..53f88b97302 100644 --- a/pkg/front_end/testcases/extension_types/duplicate_constructors.dart.strong.expect +++ b/pkg/front_end/testcases/extension_types/duplicate_constructors.dart.strong.expect @@ -4,38 +4,38 @@ library; // // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:6:3: Error: 'ET1' is already declared in this scope. // ET1.new(this.id); -// ^^^ +// ^^^^^^^ // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:5:19: Context: Previous declaration of 'ET1'. // extension type ET1(int id) { -// ^^^ +// ^ // // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:10:3: Error: 'ET2' is already declared in this scope. // ET2(this.id); // ^^^ // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:9:22: Context: Previous declaration of 'ET2'. // extension type ET2(T id) { -// ^^^ +// ^ // // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:14:3: Error: 'ET3' is already declared in this scope. // ET3(this.id); // ^^^ // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:13:20: Context: Previous declaration of 'ET3'. // extension type ET3.new(int id) { -// ^^^ +// ^ // // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:18:3: Error: 'ET4' is already declared in this scope. // ET4.new(this.id); -// ^^^ +// ^^^^^^^ // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:17:23: Context: Previous declaration of 'ET4'. // extension type ET4.new(T id) { -// ^^^ +// ^ // // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:22:3: Error: 'ET5.n' is already declared in this scope. // ET5.n(this.id); // ^^^^^ // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:21:20: Context: Previous declaration of 'ET5.n'. // extension type ET5.n(int id) { -// ^^^^^ +// ^ // import self as self; import "dart:core" as core; diff --git a/pkg/front_end/testcases/extension_types/duplicate_constructors.dart.strong.modular.expect b/pkg/front_end/testcases/extension_types/duplicate_constructors.dart.strong.modular.expect index e3b8c3df803..53f88b97302 100644 --- a/pkg/front_end/testcases/extension_types/duplicate_constructors.dart.strong.modular.expect +++ b/pkg/front_end/testcases/extension_types/duplicate_constructors.dart.strong.modular.expect @@ -4,38 +4,38 @@ library; // // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:6:3: Error: 'ET1' is already declared in this scope. // ET1.new(this.id); -// ^^^ +// ^^^^^^^ // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:5:19: Context: Previous declaration of 'ET1'. // extension type ET1(int id) { -// ^^^ +// ^ // // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:10:3: Error: 'ET2' is already declared in this scope. // ET2(this.id); // ^^^ // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:9:22: Context: Previous declaration of 'ET2'. // extension type ET2(T id) { -// ^^^ +// ^ // // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:14:3: Error: 'ET3' is already declared in this scope. // ET3(this.id); // ^^^ // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:13:20: Context: Previous declaration of 'ET3'. // extension type ET3.new(int id) { -// ^^^ +// ^ // // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:18:3: Error: 'ET4' is already declared in this scope. // ET4.new(this.id); -// ^^^ +// ^^^^^^^ // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:17:23: Context: Previous declaration of 'ET4'. // extension type ET4.new(T id) { -// ^^^ +// ^ // // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:22:3: Error: 'ET5.n' is already declared in this scope. // ET5.n(this.id); // ^^^^^ // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:21:20: Context: Previous declaration of 'ET5.n'. // extension type ET5.n(int id) { -// ^^^^^ +// ^ // import self as self; import "dart:core" as core; diff --git a/pkg/front_end/testcases/extension_types/duplicate_constructors.dart.strong.outline.expect b/pkg/front_end/testcases/extension_types/duplicate_constructors.dart.strong.outline.expect index 72ccb8587c5..9a6b1843350 100644 --- a/pkg/front_end/testcases/extension_types/duplicate_constructors.dart.strong.outline.expect +++ b/pkg/front_end/testcases/extension_types/duplicate_constructors.dart.strong.outline.expect @@ -4,38 +4,38 @@ library; // // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:6:3: Error: 'ET1' is already declared in this scope. // ET1.new(this.id); -// ^^^ +// ^^^^^^^ // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:5:19: Context: Previous declaration of 'ET1'. // extension type ET1(int id) { -// ^^^ +// ^ // // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:10:3: Error: 'ET2' is already declared in this scope. // ET2(this.id); // ^^^ // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:9:22: Context: Previous declaration of 'ET2'. // extension type ET2(T id) { -// ^^^ +// ^ // // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:14:3: Error: 'ET3' is already declared in this scope. // ET3(this.id); // ^^^ // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:13:20: Context: Previous declaration of 'ET3'. // extension type ET3.new(int id) { -// ^^^ +// ^ // // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:18:3: Error: 'ET4' is already declared in this scope. // ET4.new(this.id); -// ^^^ +// ^^^^^^^ // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:17:23: Context: Previous declaration of 'ET4'. // extension type ET4.new(T id) { -// ^^^ +// ^ // // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:22:3: Error: 'ET5.n' is already declared in this scope. // ET5.n(this.id); // ^^^^^ // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:21:20: Context: Previous declaration of 'ET5.n'. // extension type ET5.n(int id) { -// ^^^^^ +// ^ // import self as self; import "dart:core" as core; diff --git a/pkg/front_end/testcases/extension_types/duplicate_constructors.dart.strong.transformed.expect b/pkg/front_end/testcases/extension_types/duplicate_constructors.dart.strong.transformed.expect index e3b8c3df803..53f88b97302 100644 --- a/pkg/front_end/testcases/extension_types/duplicate_constructors.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/extension_types/duplicate_constructors.dart.strong.transformed.expect @@ -4,38 +4,38 @@ library; // // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:6:3: Error: 'ET1' is already declared in this scope. // ET1.new(this.id); -// ^^^ +// ^^^^^^^ // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:5:19: Context: Previous declaration of 'ET1'. // extension type ET1(int id) { -// ^^^ +// ^ // // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:10:3: Error: 'ET2' is already declared in this scope. // ET2(this.id); // ^^^ // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:9:22: Context: Previous declaration of 'ET2'. // extension type ET2(T id) { -// ^^^ +// ^ // // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:14:3: Error: 'ET3' is already declared in this scope. // ET3(this.id); // ^^^ // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:13:20: Context: Previous declaration of 'ET3'. // extension type ET3.new(int id) { -// ^^^ +// ^ // // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:18:3: Error: 'ET4' is already declared in this scope. // ET4.new(this.id); -// ^^^ +// ^^^^^^^ // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:17:23: Context: Previous declaration of 'ET4'. // extension type ET4.new(T id) { -// ^^^ +// ^ // // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:22:3: Error: 'ET5.n' is already declared in this scope. // ET5.n(this.id); // ^^^^^ // pkg/front_end/testcases/extension_types/duplicate_constructors.dart:21:20: Context: Previous declaration of 'ET5.n'. // extension type ET5.n(int id) { -// ^^^^^ +// ^ // import self as self; import "dart:core" as core; diff --git a/pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart.strong.expect b/pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart.strong.expect index 37c9b722bd1..e8cbcfdcda6 100644 --- a/pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart.strong.expect +++ b/pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart.strong.expect @@ -107,24 +107,24 @@ library; // // pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart:5:9: Error: 'Foo./' is already declared in this scope. // Foo()./ : super() {} -// ^^^^^ +// ^ // pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart:3:9: Context: Previous declaration of 'Foo./'. // Foo() / : super() {} -// ^^^^^ +// ^ // // pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart:7:9: Error: 'Foo./' is already declared in this scope. // foo() / : super() {} -// ^^^^^ +// ^ // pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart:5:9: Context: Previous declaration of 'Foo./'. // Foo()./ : super() {} -// ^^^^^ +// ^ // // pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart:9:9: Error: 'Foo./' is already declared in this scope. // foo()./ : super() {} -// ^^^^^ +// ^ // pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart:7:9: Context: Previous declaration of 'Foo./'. // foo() / : super() {} -// ^^^^^ +// ^ // // pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart:9:3: Error: 'foo' is already declared in this scope. // foo()./ : super() {} diff --git a/pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart.strong.modular.expect b/pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart.strong.modular.expect index 37c9b722bd1..e8cbcfdcda6 100644 --- a/pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart.strong.modular.expect +++ b/pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart.strong.modular.expect @@ -107,24 +107,24 @@ library; // // pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart:5:9: Error: 'Foo./' is already declared in this scope. // Foo()./ : super() {} -// ^^^^^ +// ^ // pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart:3:9: Context: Previous declaration of 'Foo./'. // Foo() / : super() {} -// ^^^^^ +// ^ // // pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart:7:9: Error: 'Foo./' is already declared in this scope. // foo() / : super() {} -// ^^^^^ +// ^ // pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart:5:9: Context: Previous declaration of 'Foo./'. // Foo()./ : super() {} -// ^^^^^ +// ^ // // pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart:9:9: Error: 'Foo./' is already declared in this scope. // foo()./ : super() {} -// ^^^^^ +// ^ // pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart:7:9: Context: Previous declaration of 'Foo./'. // foo() / : super() {} -// ^^^^^ +// ^ // // pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart:9:3: Error: 'foo' is already declared in this scope. // foo()./ : super() {} diff --git a/pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart.strong.outline.expect b/pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart.strong.outline.expect index f9bdf81b648..890a602878c 100644 --- a/pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart.strong.outline.expect +++ b/pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart.strong.outline.expect @@ -107,24 +107,24 @@ library; // // pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart:5:9: Error: 'Foo./' is already declared in this scope. // Foo()./ : super() {} -// ^^^^^ +// ^ // pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart:3:9: Context: Previous declaration of 'Foo./'. // Foo() / : super() {} -// ^^^^^ +// ^ // // pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart:7:9: Error: 'Foo./' is already declared in this scope. // foo() / : super() {} -// ^^^^^ +// ^ // pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart:5:9: Context: Previous declaration of 'Foo./'. // Foo()./ : super() {} -// ^^^^^ +// ^ // // pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart:9:9: Error: 'Foo./' is already declared in this scope. // foo()./ : super() {} -// ^^^^^ +// ^ // pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart:7:9: Context: Previous declaration of 'Foo./'. // foo() / : super() {} -// ^^^^^ +// ^ // // pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart:9:3: Error: 'foo' is already declared in this scope. // foo()./ : super() {} diff --git a/pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart.strong.transformed.expect b/pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart.strong.transformed.expect index 37c9b722bd1..e8cbcfdcda6 100644 --- a/pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart.strong.transformed.expect +++ b/pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart.strong.transformed.expect @@ -107,24 +107,24 @@ library; // // pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart:5:9: Error: 'Foo./' is already declared in this scope. // Foo()./ : super() {} -// ^^^^^ +// ^ // pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart:3:9: Context: Previous declaration of 'Foo./'. // Foo() / : super() {} -// ^^^^^ +// ^ // // pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart:7:9: Error: 'Foo./' is already declared in this scope. // foo() / : super() {} -// ^^^^^ +// ^ // pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart:5:9: Context: Previous declaration of 'Foo./'. // Foo()./ : super() {} -// ^^^^^ +// ^ // // pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart:9:9: Error: 'Foo./' is already declared in this scope. // foo()./ : super() {} -// ^^^^^ +// ^ // pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart:7:9: Context: Previous declaration of 'Foo./'. // foo() / : super() {} -// ^^^^^ +// ^ // // pkg/front_end/testcases/general/error_recovery/constructor_recovery_operator.crash_dart:9:3: Error: 'foo' is already declared in this scope. // foo()./ : super() {}