From 8b01baab714cb6462a5172a9ba0d19ac7fbcae1f Mon Sep 17 00:00:00 2001 From: Chloe Stefantsova Date: Wed, 1 Nov 2023 10:14:49 +0000 Subject: [PATCH] [cfe] Perform checks on factories of extension type declarations Closes https://github.com/dart-lang/sdk/issues/53209 Closes https://github.com/dart-lang/sdk/issues/53140 Part of https://github.com/dart-lang/sdk/issues/49731 Change-Id: Ia94b1e85d6775efc23bf732441fa66d4de1de515 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332403 Reviewed-by: Johnni Winther Commit-Queue: Chloe Stefantsova --- .../lib/src/fasta/kernel/kernel_target.dart | 3 +- ...ce_extension_type_declaration_builder.dart | 10 + .../fasta/source/source_factory_builder.dart | 15 ++ .../lib/src/fasta/source/source_loader.dart | 12 +- .../fasta/type_inference/type_inferrer.dart | 2 +- .../test/spell_checking_list_tests.txt | 1 + .../dart2js/issue47916e.dart.strong.expect | 11 +- ...issue47916e.dart.strong.transformed.expect | 11 +- .../dart2js/issue47916e.dart.weak.expect | 11 +- .../issue47916e.dart.weak.modular.expect | 11 +- .../issue47916e.dart.weak.outline.expect | 11 +- .../issue47916e.dart.weak.transformed.expect | 11 +- .../dart2js/issue47916f.dart.strong.expect | 11 +- ...issue47916f.dart.strong.transformed.expect | 11 +- .../dart2js/issue47916f.dart.weak.expect | 11 +- .../issue47916f.dart.weak.modular.expect | 11 +- .../issue47916f.dart.weak.outline.expect | 11 +- .../issue47916f.dart.weak.transformed.expect | 11 +- .../generic_factory.dart.strong.expect | 6 +- ...ric_factory.dart.strong.transformed.expect | 12 +- .../generic_factory.dart.weak.expect | 6 +- .../generic_factory.dart.weak.modular.expect | 6 +- .../generic_factory.dart.weak.outline.expect | 6 +- ...neric_factory.dart.weak.transformed.expect | 12 +- .../testcases/extension_types/issue53209.dart | 22 +++ .../issue53209.dart.strong.expect | 172 ++++++++++++++++++ .../issue53209.dart.strong.transformed.expect | 172 ++++++++++++++++++ .../issue53209.dart.textual_outline.expect | 14 ++ ...53209.dart.textual_outline_modelled.expect | 14 ++ .../issue53209.dart.weak.expect | 172 ++++++++++++++++++ .../issue53209.dart.weak.modular.expect | 172 ++++++++++++++++++ .../issue53209.dart.weak.outline.expect | 164 +++++++++++++++++ .../issue53209.dart.weak.transformed.expect | 172 ++++++++++++++++++ 33 files changed, 1228 insertions(+), 69 deletions(-) create mode 100644 pkg/front_end/testcases/extension_types/issue53209.dart create mode 100644 pkg/front_end/testcases/extension_types/issue53209.dart.strong.expect create mode 100644 pkg/front_end/testcases/extension_types/issue53209.dart.strong.transformed.expect create mode 100644 pkg/front_end/testcases/extension_types/issue53209.dart.textual_outline.expect create mode 100644 pkg/front_end/testcases/extension_types/issue53209.dart.textual_outline_modelled.expect create mode 100644 pkg/front_end/testcases/extension_types/issue53209.dart.weak.expect create mode 100644 pkg/front_end/testcases/extension_types/issue53209.dart.weak.modular.expect create mode 100644 pkg/front_end/testcases/extension_types/issue53209.dart.weak.outline.expect create mode 100644 pkg/front_end/testcases/extension_types/issue53209.dart.weak.transformed.expect diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart index 76213af5847..cab83caa938 100644 --- a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart +++ b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart @@ -530,7 +530,8 @@ class KernelTarget extends TargetImplementation { benchmarker ?.enterPhase(BenchmarkPhases.outline_checkRedirectingFactories); - loader.checkRedirectingFactories(sortedSourceClassBuilders); + loader.checkRedirectingFactories( + sortedSourceClassBuilders, sortedSourceExtensionTypeBuilders); benchmarker ?.enterPhase(BenchmarkPhases.outline_finishSynthesizedParameters); diff --git a/pkg/front_end/lib/src/fasta/source/source_extension_type_declaration_builder.dart b/pkg/front_end/lib/src/fasta/source/source_extension_type_declaration_builder.dart index 0160ff76786..2d0bf9ce462 100644 --- a/pkg/front_end/lib/src/fasta/source/source_extension_type_declaration_builder.dart +++ b/pkg/front_end/lib/src/fasta/source/source_extension_type_declaration_builder.dart @@ -32,6 +32,7 @@ import '../util/helpers.dart'; import 'class_declaration.dart'; import 'source_builder_mixins.dart'; import 'source_constructor_builder.dart'; +import 'source_factory_builder.dart'; import 'source_field_builder.dart'; import 'source_library_builder.dart'; import 'source_member_builder.dart'; @@ -484,6 +485,15 @@ class SourceExtensionTypeDeclarationBuilder } } + void checkRedirectingFactories(TypeEnvironment typeEnvironment) { + Iterator iterator = + constructorScope.filteredIterator( + parent: this, includeDuplicates: true, includeAugmentations: true); + while (iterator.moveNext()) { + iterator.current.checkRedirectingFactories(typeEnvironment); + } + } + @override void buildOutlineExpressions( ClassHierarchy classHierarchy, diff --git a/pkg/front_end/lib/src/fasta/source/source_factory_builder.dart b/pkg/front_end/lib/src/fasta/source/source_factory_builder.dart index dea0d431990..733fb4f0f79 100644 --- a/pkg/front_end/lib/src/fasta/source/source_factory_builder.dart +++ b/pkg/front_end/lib/src/fasta/source/source_factory_builder.dart @@ -336,6 +336,8 @@ class RedirectingFactoryBuilder extends SourceFactoryBuilder { FreshTypeParameters? _tearOffTypeParameters; + bool _hasBeenCheckedAsRedirectingFactory = false; + RedirectingFactoryBuilder( List? metadata, int modifiers, @@ -737,6 +739,9 @@ class RedirectingFactoryBuilder extends SourceFactoryBuilder { @override void _checkRedirectingFactory(TypeEnvironment typeEnvironment) { + if (_hasBeenCheckedAsRedirectingFactory) return; + _hasBeenCheckedAsRedirectingFactory = true; + // Check that factory declaration is not cyclic. if (_isCyclicRedirectingFactory(this)) { libraryBuilder.addProblemForRedirectingFactory( @@ -788,6 +793,16 @@ class RedirectingFactoryBuilder extends SourceFactoryBuilder { return; } + Builder? redirectionTargetBuilder = redirectionTarget.target; + if (redirectionTargetBuilder is RedirectingFactoryBuilder) { + redirectionTargetBuilder._checkRedirectingFactory(typeEnvironment); + String? errorMessage = redirectionTargetBuilder + .function.redirectingFactoryTarget?.errorMessage; + if (errorMessage != null) { + setRedirectingFactoryError(errorMessage); + } + } + // Redirection to generative enum constructors is forbidden and is reported // as an error elsewhere. if (!((classBuilder?.cls.isEnum ?? false) && diff --git a/pkg/front_end/lib/src/fasta/source/source_loader.dart b/pkg/front_end/lib/src/fasta/source/source_loader.dart index 6302b0d0036..4926d9a8b47 100644 --- a/pkg/front_end/lib/src/fasta/source/source_loader.dart +++ b/pkg/front_end/lib/src/fasta/source/source_loader.dart @@ -2774,7 +2774,10 @@ severity: $severity .logMs("Updated ${changedClasses.length} classes in kernel hierarchy"); } - void checkRedirectingFactories(List sourceClasses) { + void checkRedirectingFactories( + List sourceClasses, + List + sourceExtensionTypeDeclarationBuilders) { // TODO(ahe): Move this to [ClassHierarchyBuilder]. for (SourceClassBuilder builder in sourceClasses) { if (builder.libraryBuilder.loader == this && !builder.isPatch) { @@ -2782,6 +2785,13 @@ severity: $severity typeInferenceEngine.typeSchemaEnvironment); } } + for (SourceExtensionTypeDeclarationBuilder builder + in sourceExtensionTypeDeclarationBuilders) { + if (builder.libraryBuilder.loader == this && !builder.isPatch) { + builder.checkRedirectingFactories( + typeInferenceEngine.typeSchemaEnvironment); + } + } ticker.logMs("Checked redirecting factories"); } diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart index 7fc1400fe09..38ab40dc776 100644 --- a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart +++ b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart @@ -248,7 +248,7 @@ class TypeInferrerImpl implements TypeInferrer { staticTarget: target); visitor.checkCleanState(); DartType resultType = result.inferredType; - if (resultType is InterfaceType) { + if (resultType is TypeDeclarationType) { return resultType.typeArguments; } else { return null; diff --git a/pkg/front_end/test/spell_checking_list_tests.txt b/pkg/front_end/test/spell_checking_list_tests.txt index f054d08676d..b0c04176579 100644 --- a/pkg/front_end/test/spell_checking_list_tests.txt +++ b/pkg/front_end/test/spell_checking_list_tests.txt @@ -339,6 +339,7 @@ gave gc gcd gclient +ge gesture gi gm diff --git a/pkg/front_end/testcases/dart2js/issue47916e.dart.strong.expect b/pkg/front_end/testcases/dart2js/issue47916e.dart.strong.expect index 550d63bd61c..c52c3f6f212 100644 --- a/pkg/front_end/testcases/dart2js/issue47916e.dart.strong.expect +++ b/pkg/front_end/testcases/dart2js/issue47916e.dart.strong.expect @@ -10,9 +10,14 @@ import self as self; import "dart:core" as core; abstract class A extends core::Object { - static factory •() → self::A /* redirection-target: self::B::• */ - return self::B::•(); - static method _#new#tearOff() → self::A; + static factory •() → self::A + return invalid-expression "pkg/front_end/testcases/dart2js/issue47916e.dart:10:23: Error: Redirection constructor target not found: 'C.named' + const factory B() = C.named; + ^"; + static method _#new#tearOff() → self::A + return invalid-expression "pkg/front_end/testcases/dart2js/issue47916e.dart:10:23: Error: Redirection constructor target not found: 'C.named' + const factory B() = C.named; + ^"; } abstract class B extends core::Object implements self::A { static factory •() → self::B diff --git a/pkg/front_end/testcases/dart2js/issue47916e.dart.strong.transformed.expect b/pkg/front_end/testcases/dart2js/issue47916e.dart.strong.transformed.expect index 550d63bd61c..c52c3f6f212 100644 --- a/pkg/front_end/testcases/dart2js/issue47916e.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/dart2js/issue47916e.dart.strong.transformed.expect @@ -10,9 +10,14 @@ import self as self; import "dart:core" as core; abstract class A extends core::Object { - static factory •() → self::A /* redirection-target: self::B::• */ - return self::B::•(); - static method _#new#tearOff() → self::A; + static factory •() → self::A + return invalid-expression "pkg/front_end/testcases/dart2js/issue47916e.dart:10:23: Error: Redirection constructor target not found: 'C.named' + const factory B() = C.named; + ^"; + static method _#new#tearOff() → self::A + return invalid-expression "pkg/front_end/testcases/dart2js/issue47916e.dart:10:23: Error: Redirection constructor target not found: 'C.named' + const factory B() = C.named; + ^"; } abstract class B extends core::Object implements self::A { static factory •() → self::B diff --git a/pkg/front_end/testcases/dart2js/issue47916e.dart.weak.expect b/pkg/front_end/testcases/dart2js/issue47916e.dart.weak.expect index 550d63bd61c..c52c3f6f212 100644 --- a/pkg/front_end/testcases/dart2js/issue47916e.dart.weak.expect +++ b/pkg/front_end/testcases/dart2js/issue47916e.dart.weak.expect @@ -10,9 +10,14 @@ import self as self; import "dart:core" as core; abstract class A extends core::Object { - static factory •() → self::A /* redirection-target: self::B::• */ - return self::B::•(); - static method _#new#tearOff() → self::A; + static factory •() → self::A + return invalid-expression "pkg/front_end/testcases/dart2js/issue47916e.dart:10:23: Error: Redirection constructor target not found: 'C.named' + const factory B() = C.named; + ^"; + static method _#new#tearOff() → self::A + return invalid-expression "pkg/front_end/testcases/dart2js/issue47916e.dart:10:23: Error: Redirection constructor target not found: 'C.named' + const factory B() = C.named; + ^"; } abstract class B extends core::Object implements self::A { static factory •() → self::B diff --git a/pkg/front_end/testcases/dart2js/issue47916e.dart.weak.modular.expect b/pkg/front_end/testcases/dart2js/issue47916e.dart.weak.modular.expect index 550d63bd61c..c52c3f6f212 100644 --- a/pkg/front_end/testcases/dart2js/issue47916e.dart.weak.modular.expect +++ b/pkg/front_end/testcases/dart2js/issue47916e.dart.weak.modular.expect @@ -10,9 +10,14 @@ import self as self; import "dart:core" as core; abstract class A extends core::Object { - static factory •() → self::A /* redirection-target: self::B::• */ - return self::B::•(); - static method _#new#tearOff() → self::A; + static factory •() → self::A + return invalid-expression "pkg/front_end/testcases/dart2js/issue47916e.dart:10:23: Error: Redirection constructor target not found: 'C.named' + const factory B() = C.named; + ^"; + static method _#new#tearOff() → self::A + return invalid-expression "pkg/front_end/testcases/dart2js/issue47916e.dart:10:23: Error: Redirection constructor target not found: 'C.named' + const factory B() = C.named; + ^"; } abstract class B extends core::Object implements self::A { static factory •() → self::B diff --git a/pkg/front_end/testcases/dart2js/issue47916e.dart.weak.outline.expect b/pkg/front_end/testcases/dart2js/issue47916e.dart.weak.outline.expect index 8d24f1625f2..9385f9ffe59 100644 --- a/pkg/front_end/testcases/dart2js/issue47916e.dart.weak.outline.expect +++ b/pkg/front_end/testcases/dart2js/issue47916e.dart.weak.outline.expect @@ -10,9 +10,14 @@ import self as self; import "dart:core" as core; abstract class A extends core::Object { - static factory •() → self::A /* redirection-target: self::B::• */ - return self::B::•(); - static method _#new#tearOff() → self::A; + static factory •() → self::A + return invalid-expression "pkg/front_end/testcases/dart2js/issue47916e.dart:10:23: Error: Redirection constructor target not found: 'C.named' + const factory B() = C.named; + ^"; + static method _#new#tearOff() → self::A + return invalid-expression "pkg/front_end/testcases/dart2js/issue47916e.dart:10:23: Error: Redirection constructor target not found: 'C.named' + const factory B() = C.named; + ^"; } abstract class B extends core::Object implements self::A { static factory •() → self::B diff --git a/pkg/front_end/testcases/dart2js/issue47916e.dart.weak.transformed.expect b/pkg/front_end/testcases/dart2js/issue47916e.dart.weak.transformed.expect index 550d63bd61c..c52c3f6f212 100644 --- a/pkg/front_end/testcases/dart2js/issue47916e.dart.weak.transformed.expect +++ b/pkg/front_end/testcases/dart2js/issue47916e.dart.weak.transformed.expect @@ -10,9 +10,14 @@ import self as self; import "dart:core" as core; abstract class A extends core::Object { - static factory •() → self::A /* redirection-target: self::B::• */ - return self::B::•(); - static method _#new#tearOff() → self::A; + static factory •() → self::A + return invalid-expression "pkg/front_end/testcases/dart2js/issue47916e.dart:10:23: Error: Redirection constructor target not found: 'C.named' + const factory B() = C.named; + ^"; + static method _#new#tearOff() → self::A + return invalid-expression "pkg/front_end/testcases/dart2js/issue47916e.dart:10:23: Error: Redirection constructor target not found: 'C.named' + const factory B() = C.named; + ^"; } abstract class B extends core::Object implements self::A { static factory •() → self::B diff --git a/pkg/front_end/testcases/dart2js/issue47916f.dart.strong.expect b/pkg/front_end/testcases/dart2js/issue47916f.dart.strong.expect index d85a4015dbd..22cff620c7b 100644 --- a/pkg/front_end/testcases/dart2js/issue47916f.dart.strong.expect +++ b/pkg/front_end/testcases/dart2js/issue47916f.dart.strong.expect @@ -14,9 +14,14 @@ import self as self; import "dart:core" as core; abstract class A extends core::Object { - static factory •() → self::A /* redirection-target: self::B::•*/ - return self::B::•(); - static method _#new#tearOff() → self::A; + static factory •() → self::A + return invalid-expression "pkg/front_end/testcases/dart2js/issue47916f.dart:10:17: Error: Cyclic definition of factory 'B'. + const factory B() = C; + ^"; + static method _#new#tearOff() → self::A + return invalid-expression "pkg/front_end/testcases/dart2js/issue47916f.dart:10:17: Error: Cyclic definition of factory 'B'. + const factory B() = C; + ^"; } abstract class B extends core::Object implements self::A { static factory •() → self::B diff --git a/pkg/front_end/testcases/dart2js/issue47916f.dart.strong.transformed.expect b/pkg/front_end/testcases/dart2js/issue47916f.dart.strong.transformed.expect index d85a4015dbd..22cff620c7b 100644 --- a/pkg/front_end/testcases/dart2js/issue47916f.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/dart2js/issue47916f.dart.strong.transformed.expect @@ -14,9 +14,14 @@ import self as self; import "dart:core" as core; abstract class A extends core::Object { - static factory •() → self::A /* redirection-target: self::B::•*/ - return self::B::•(); - static method _#new#tearOff() → self::A; + static factory •() → self::A + return invalid-expression "pkg/front_end/testcases/dart2js/issue47916f.dart:10:17: Error: Cyclic definition of factory 'B'. + const factory B() = C; + ^"; + static method _#new#tearOff() → self::A + return invalid-expression "pkg/front_end/testcases/dart2js/issue47916f.dart:10:17: Error: Cyclic definition of factory 'B'. + const factory B() = C; + ^"; } abstract class B extends core::Object implements self::A { static factory •() → self::B diff --git a/pkg/front_end/testcases/dart2js/issue47916f.dart.weak.expect b/pkg/front_end/testcases/dart2js/issue47916f.dart.weak.expect index d85a4015dbd..22cff620c7b 100644 --- a/pkg/front_end/testcases/dart2js/issue47916f.dart.weak.expect +++ b/pkg/front_end/testcases/dart2js/issue47916f.dart.weak.expect @@ -14,9 +14,14 @@ import self as self; import "dart:core" as core; abstract class A extends core::Object { - static factory •() → self::A /* redirection-target: self::B::•*/ - return self::B::•(); - static method _#new#tearOff() → self::A; + static factory •() → self::A + return invalid-expression "pkg/front_end/testcases/dart2js/issue47916f.dart:10:17: Error: Cyclic definition of factory 'B'. + const factory B() = C; + ^"; + static method _#new#tearOff() → self::A + return invalid-expression "pkg/front_end/testcases/dart2js/issue47916f.dart:10:17: Error: Cyclic definition of factory 'B'. + const factory B() = C; + ^"; } abstract class B extends core::Object implements self::A { static factory •() → self::B diff --git a/pkg/front_end/testcases/dart2js/issue47916f.dart.weak.modular.expect b/pkg/front_end/testcases/dart2js/issue47916f.dart.weak.modular.expect index d85a4015dbd..22cff620c7b 100644 --- a/pkg/front_end/testcases/dart2js/issue47916f.dart.weak.modular.expect +++ b/pkg/front_end/testcases/dart2js/issue47916f.dart.weak.modular.expect @@ -14,9 +14,14 @@ import self as self; import "dart:core" as core; abstract class A extends core::Object { - static factory •() → self::A /* redirection-target: self::B::•*/ - return self::B::•(); - static method _#new#tearOff() → self::A; + static factory •() → self::A + return invalid-expression "pkg/front_end/testcases/dart2js/issue47916f.dart:10:17: Error: Cyclic definition of factory 'B'. + const factory B() = C; + ^"; + static method _#new#tearOff() → self::A + return invalid-expression "pkg/front_end/testcases/dart2js/issue47916f.dart:10:17: Error: Cyclic definition of factory 'B'. + const factory B() = C; + ^"; } abstract class B extends core::Object implements self::A { static factory •() → self::B diff --git a/pkg/front_end/testcases/dart2js/issue47916f.dart.weak.outline.expect b/pkg/front_end/testcases/dart2js/issue47916f.dart.weak.outline.expect index 97b4642484d..6a495cfbb5d 100644 --- a/pkg/front_end/testcases/dart2js/issue47916f.dart.weak.outline.expect +++ b/pkg/front_end/testcases/dart2js/issue47916f.dart.weak.outline.expect @@ -14,9 +14,14 @@ import self as self; import "dart:core" as core; abstract class A extends core::Object { - static factory •() → self::A /* redirection-target: self::B::•*/ - return self::B::•(); - static method _#new#tearOff() → self::A; + static factory •() → self::A + return invalid-expression "pkg/front_end/testcases/dart2js/issue47916f.dart:10:17: Error: Cyclic definition of factory 'B'. + const factory B() = C; + ^"; + static method _#new#tearOff() → self::A + return invalid-expression "pkg/front_end/testcases/dart2js/issue47916f.dart:10:17: Error: Cyclic definition of factory 'B'. + const factory B() = C; + ^"; } abstract class B extends core::Object implements self::A { static factory •() → self::B diff --git a/pkg/front_end/testcases/dart2js/issue47916f.dart.weak.transformed.expect b/pkg/front_end/testcases/dart2js/issue47916f.dart.weak.transformed.expect index d85a4015dbd..22cff620c7b 100644 --- a/pkg/front_end/testcases/dart2js/issue47916f.dart.weak.transformed.expect +++ b/pkg/front_end/testcases/dart2js/issue47916f.dart.weak.transformed.expect @@ -14,9 +14,14 @@ import self as self; import "dart:core" as core; abstract class A extends core::Object { - static factory •() → self::A /* redirection-target: self::B::•*/ - return self::B::•(); - static method _#new#tearOff() → self::A; + static factory •() → self::A + return invalid-expression "pkg/front_end/testcases/dart2js/issue47916f.dart:10:17: Error: Cyclic definition of factory 'B'. + const factory B() = C; + ^"; + static method _#new#tearOff() → self::A + return invalid-expression "pkg/front_end/testcases/dart2js/issue47916f.dart:10:17: Error: Cyclic definition of factory 'B'. + const factory B() = C; + ^"; } abstract class B extends core::Object implements self::A { static factory •() → self::B diff --git a/pkg/front_end/testcases/extension_types/generic_factory.dart.strong.expect b/pkg/front_end/testcases/extension_types/generic_factory.dart.strong.expect index 0d514d16a31..4a8481b7161 100644 --- a/pkg/front_end/testcases/extension_types/generic_factory.dart.strong.expect +++ b/pkg/front_end/testcases/extension_types/generic_factory.dart.strong.expect @@ -24,7 +24,7 @@ static inline-class-member method ET3|constructor#c1() → } static inline-class-member method ET3|constructor#_#c1#tearOff() → self::ET3 /* = core::int */ return self::ET3|constructor#c1(); -static inline-class-member method ET3|constructor#f1() → self::ET3 /* = core::int */ /* redirection-target: self::ET3|constructor#c1*/ - return self::ET3|constructor#c1(); +static inline-class-member method ET3|constructor#f1() → self::ET3 /* = core::int */ /* redirection-target: self::ET3|constructor#c1*/ + return self::ET3|constructor#c1(); static inline-class-member method ET3|constructor#_#f1#tearOff() → self::ET3 /* = core::int */ - return self::ET3|constructor#c1(); + return self::ET3|constructor#c1(); diff --git a/pkg/front_end/testcases/extension_types/generic_factory.dart.strong.transformed.expect b/pkg/front_end/testcases/extension_types/generic_factory.dart.strong.transformed.expect index 51d6129660a..4a8481b7161 100644 --- a/pkg/front_end/testcases/extension_types/generic_factory.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/extension_types/generic_factory.dart.strong.transformed.expect @@ -24,13 +24,7 @@ static inline-class-member method ET3|constructor#c1() → } static inline-class-member method ET3|constructor#_#c1#tearOff() → self::ET3 /* = core::int */ return self::ET3|constructor#c1(); -static inline-class-member method ET3|constructor#f1() → self::ET3 /* = core::int */ /* redirection-target: self::ET3|constructor#c1*/ - return self::ET3|constructor#c1(); +static inline-class-member method ET3|constructor#f1() → self::ET3 /* = core::int */ /* redirection-target: self::ET3|constructor#c1*/ + return self::ET3|constructor#c1(); static inline-class-member method ET3|constructor#_#f1#tearOff() → self::ET3 /* = core::int */ - return self::ET3|constructor#c1(); - - -Extra constant evaluation status: -Evaluated: StaticInvocation @ org-dartlang-testcase:///generic_factory.dart:7:17 -> IntConstant(0) -Evaluated: StaticInvocation @ org-dartlang-testcase:///generic_factory.dart:7:11 -> IntConstant(0) -Extra constant evaluation: evaluated: 10, effectively constant: 2 + return self::ET3|constructor#c1(); diff --git a/pkg/front_end/testcases/extension_types/generic_factory.dart.weak.expect b/pkg/front_end/testcases/extension_types/generic_factory.dart.weak.expect index 0d514d16a31..4a8481b7161 100644 --- a/pkg/front_end/testcases/extension_types/generic_factory.dart.weak.expect +++ b/pkg/front_end/testcases/extension_types/generic_factory.dart.weak.expect @@ -24,7 +24,7 @@ static inline-class-member method ET3|constructor#c1() → } static inline-class-member method ET3|constructor#_#c1#tearOff() → self::ET3 /* = core::int */ return self::ET3|constructor#c1(); -static inline-class-member method ET3|constructor#f1() → self::ET3 /* = core::int */ /* redirection-target: self::ET3|constructor#c1*/ - return self::ET3|constructor#c1(); +static inline-class-member method ET3|constructor#f1() → self::ET3 /* = core::int */ /* redirection-target: self::ET3|constructor#c1*/ + return self::ET3|constructor#c1(); static inline-class-member method ET3|constructor#_#f1#tearOff() → self::ET3 /* = core::int */ - return self::ET3|constructor#c1(); + return self::ET3|constructor#c1(); diff --git a/pkg/front_end/testcases/extension_types/generic_factory.dart.weak.modular.expect b/pkg/front_end/testcases/extension_types/generic_factory.dart.weak.modular.expect index 0d514d16a31..4a8481b7161 100644 --- a/pkg/front_end/testcases/extension_types/generic_factory.dart.weak.modular.expect +++ b/pkg/front_end/testcases/extension_types/generic_factory.dart.weak.modular.expect @@ -24,7 +24,7 @@ static inline-class-member method ET3|constructor#c1() → } static inline-class-member method ET3|constructor#_#c1#tearOff() → self::ET3 /* = core::int */ return self::ET3|constructor#c1(); -static inline-class-member method ET3|constructor#f1() → self::ET3 /* = core::int */ /* redirection-target: self::ET3|constructor#c1*/ - return self::ET3|constructor#c1(); +static inline-class-member method ET3|constructor#f1() → self::ET3 /* = core::int */ /* redirection-target: self::ET3|constructor#c1*/ + return self::ET3|constructor#c1(); static inline-class-member method ET3|constructor#_#f1#tearOff() → self::ET3 /* = core::int */ - return self::ET3|constructor#c1(); + return self::ET3|constructor#c1(); diff --git a/pkg/front_end/testcases/extension_types/generic_factory.dart.weak.outline.expect b/pkg/front_end/testcases/extension_types/generic_factory.dart.weak.outline.expect index 12ca9180be9..52319f6637e 100644 --- a/pkg/front_end/testcases/extension_types/generic_factory.dart.weak.outline.expect +++ b/pkg/front_end/testcases/extension_types/generic_factory.dart.weak.outline.expect @@ -19,7 +19,7 @@ static inline-class-member method ET3|constructor#c1() → ; static inline-class-member method ET3|constructor#_#c1#tearOff() → self::ET3 /* = core::int */ return self::ET3|constructor#c1(); -static inline-class-member method ET3|constructor#f1() → self::ET3 /* = core::int */ /* redirection-target: self::ET3|constructor#c1*/ - return self::ET3|constructor#c1(); +static inline-class-member method ET3|constructor#f1() → self::ET3 /* = core::int */ /* redirection-target: self::ET3|constructor#c1*/ + return self::ET3|constructor#c1(); static inline-class-member method ET3|constructor#_#f1#tearOff() → self::ET3 /* = core::int */ - return self::ET3|constructor#c1(); + return self::ET3|constructor#c1(); diff --git a/pkg/front_end/testcases/extension_types/generic_factory.dart.weak.transformed.expect b/pkg/front_end/testcases/extension_types/generic_factory.dart.weak.transformed.expect index 51d6129660a..4a8481b7161 100644 --- a/pkg/front_end/testcases/extension_types/generic_factory.dart.weak.transformed.expect +++ b/pkg/front_end/testcases/extension_types/generic_factory.dart.weak.transformed.expect @@ -24,13 +24,7 @@ static inline-class-member method ET3|constructor#c1() → } static inline-class-member method ET3|constructor#_#c1#tearOff() → self::ET3 /* = core::int */ return self::ET3|constructor#c1(); -static inline-class-member method ET3|constructor#f1() → self::ET3 /* = core::int */ /* redirection-target: self::ET3|constructor#c1*/ - return self::ET3|constructor#c1(); +static inline-class-member method ET3|constructor#f1() → self::ET3 /* = core::int */ /* redirection-target: self::ET3|constructor#c1*/ + return self::ET3|constructor#c1(); static inline-class-member method ET3|constructor#_#f1#tearOff() → self::ET3 /* = core::int */ - return self::ET3|constructor#c1(); - - -Extra constant evaluation status: -Evaluated: StaticInvocation @ org-dartlang-testcase:///generic_factory.dart:7:17 -> IntConstant(0) -Evaluated: StaticInvocation @ org-dartlang-testcase:///generic_factory.dart:7:11 -> IntConstant(0) -Extra constant evaluation: evaluated: 10, effectively constant: 2 + return self::ET3|constructor#c1(); diff --git a/pkg/front_end/testcases/extension_types/issue53209.dart b/pkg/front_end/testcases/extension_types/issue53209.dart new file mode 100644 index 00000000000..8431bc9fea4 --- /dev/null +++ b/pkg/front_end/testcases/extension_types/issue53209.dart @@ -0,0 +1,22 @@ +// Copyright (c) 2023, 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. + +extension type E(int foo) { + factory E.redirNotEnough() = E; // Error. + + factory E.redirTooMany1(int foo, String bar) = E; // Error. + factory E.redirTooMany2(int foo, String bar, num baz) = E; // Error. + factory E.redirTooMany3(int foo, [dynamic bar]) = E; // Error. + factory E.redirTooMany4(int foo, {required Object bar}) = E; // Error. + + factory E.redirCyclic1(int foo) = E.redirCyclic2; // Error. + factory E.redirCyclic2(int foo) = E.redirCyclic1; // Error. + + factory E.redirCyclicSelf(int foo) = E.redirCyclicSelf; // Error. +} + +extension type GE(X foo) { + factory GE.redirNotEnough1() = GE; // Error. + factory GE.redirNotEnough2() = GE.redirNotEnough1; // Should not be reported. +} diff --git a/pkg/front_end/testcases/extension_types/issue53209.dart.strong.expect b/pkg/front_end/testcases/extension_types/issue53209.dart.strong.expect new file mode 100644 index 00000000000..4eaf39ce102 --- /dev/null +++ b/pkg/front_end/testcases/extension_types/issue53209.dart.strong.expect @@ -0,0 +1,172 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/extension_types/issue53209.dart:6:32: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function()'. +// factory E.redirNotEnough() = E; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:8:50: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String)'. +// factory E.redirTooMany1(int foo, String bar) = E; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:9:59: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String, num)'. +// factory E.redirTooMany2(int foo, String bar, num baz) = E; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:10:53: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, [dynamic])'. +// factory E.redirTooMany3(int foo, [dynamic bar]) = E; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:11:61: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, {Object bar})'. +// - 'Object' is from 'dart:core'. +// factory E.redirTooMany4(int foo, {required Object bar}) = E; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:13:11: Error: Cyclic definition of factory 'E.redirCyclic1'. +// factory E.redirCyclic1(int foo) = E.redirCyclic2; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:14:11: Error: Cyclic definition of factory 'E.redirCyclic2'. +// factory E.redirCyclic2(int foo) = E.redirCyclic1; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:16:11: Error: Cyclic definition of factory 'E.redirCyclicSelf'. +// factory E.redirCyclicSelf(int foo) = E.redirCyclicSelf; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:20:34: Error: The constructor function type 'GE Function(dynamic)' isn't a subtype of 'GE Function()'. +// factory GE.redirNotEnough1() = GE; // Error. +// ^ +// +import self as self; +import "dart:core" as core; + +extension type E(core::int foo) { + abstract inline-class-member representation-field get foo() → core::int; + constructor • = self::E|constructor#; + constructor tearoff • = self::E|constructor#_#new#tearOff; + static redirecting-factory redirNotEnough = self::E|constructor#redirNotEnough; + static redirecting-factory tearoff redirNotEnough = self::E|constructor#_#redirNotEnough#tearOff; + static redirecting-factory redirTooMany1 = self::E|constructor#redirTooMany1; + static redirecting-factory tearoff redirTooMany1 = self::E|constructor#_#redirTooMany1#tearOff; + static redirecting-factory redirTooMany2 = self::E|constructor#redirTooMany2; + static redirecting-factory tearoff redirTooMany2 = self::E|constructor#_#redirTooMany2#tearOff; + static redirecting-factory redirTooMany3 = self::E|constructor#redirTooMany3; + static redirecting-factory tearoff redirTooMany3 = self::E|constructor#_#redirTooMany3#tearOff; + static redirecting-factory redirTooMany4 = self::E|constructor#redirTooMany4; + static redirecting-factory tearoff redirTooMany4 = self::E|constructor#_#redirTooMany4#tearOff; + static redirecting-factory redirCyclic1 = self::E|constructor#redirCyclic1; + static redirecting-factory tearoff redirCyclic1 = self::E|constructor#_#redirCyclic1#tearOff; + static redirecting-factory redirCyclic2 = self::E|constructor#redirCyclic2; + static redirecting-factory tearoff redirCyclic2 = self::E|constructor#_#redirCyclic2#tearOff; + static redirecting-factory redirCyclicSelf = self::E|constructor#redirCyclicSelf; + static redirecting-factory tearoff redirCyclicSelf = self::E|constructor#_#redirCyclicSelf#tearOff; +} +extension type GE(X% foo) { + abstract inline-class-member representation-field get foo() → X%; + constructor • = self::GE|constructor#; + constructor tearoff • = self::GE|constructor#_#new#tearOff; + static redirecting-factory redirNotEnough1 = self::GE|constructor#redirNotEnough1; + static redirecting-factory tearoff redirNotEnough1 = self::GE|constructor#_#redirNotEnough1#tearOff; + static redirecting-factory redirNotEnough2 = self::GE|constructor#redirNotEnough2; + static redirecting-factory tearoff redirNotEnough2 = self::GE|constructor#_#redirNotEnough2#tearOff; +} +static inline-class-member method E|constructor#(core::int foo) → self::E /* = core::int */ { + lowered final self::E /* = core::int */ #this = foo; + return #this; +} +static inline-class-member method E|constructor#_#new#tearOff(core::int foo) → self::E /* = core::int */ + return self::E|constructor#(foo); +static inline-class-member method E|constructor#redirNotEnough() → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:6:32: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function()'. + factory E.redirNotEnough() = E; // Error. + ^"; +static inline-class-member method E|constructor#_#redirNotEnough#tearOff() → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:6:32: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function()'. + factory E.redirNotEnough() = E; // Error. + ^"; +static inline-class-member method E|constructor#redirTooMany1(core::int foo, core::String bar = #C1) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:8:50: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String)'. + factory E.redirTooMany1(int foo, String bar) = E; // Error. + ^"; +static inline-class-member method E|constructor#_#redirTooMany1#tearOff(core::int foo, core::String bar = #C1) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:8:50: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String)'. + factory E.redirTooMany1(int foo, String bar) = E; // Error. + ^"; +static inline-class-member method E|constructor#redirTooMany2(core::int foo, core::String bar = #C1, core::num baz = #C1) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:9:59: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String, num)'. + factory E.redirTooMany2(int foo, String bar, num baz) = E; // Error. + ^"; +static inline-class-member method E|constructor#_#redirTooMany2#tearOff(core::int foo, core::String bar = #C1, core::num baz = #C1) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:9:59: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String, num)'. + factory E.redirTooMany2(int foo, String bar, num baz) = E; // Error. + ^"; +static inline-class-member method E|constructor#redirTooMany3(core::int foo, [dynamic bar = #C1]) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:10:53: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, [dynamic])'. + factory E.redirTooMany3(int foo, [dynamic bar]) = E; // Error. + ^"; +static inline-class-member method E|constructor#_#redirTooMany3#tearOff(core::int foo, [dynamic bar = #C1]) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:10:53: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, [dynamic])'. + factory E.redirTooMany3(int foo, [dynamic bar]) = E; // Error. + ^"; +static inline-class-member method E|constructor#redirTooMany4(core::int foo, {required core::Object bar = #C1}) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:11:61: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, {Object bar})'. + - 'Object' is from 'dart:core'. + factory E.redirTooMany4(int foo, {required Object bar}) = E; // Error. + ^"; +static inline-class-member method E|constructor#_#redirTooMany4#tearOff(core::int foo, {required core::Object bar = #C1}) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:11:61: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, {Object bar})'. + - 'Object' is from 'dart:core'. + factory E.redirTooMany4(int foo, {required Object bar}) = E; // Error. + ^"; +static inline-class-member method E|constructor#redirCyclic1(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:13:11: Error: Cyclic definition of factory 'E.redirCyclic1'. + factory E.redirCyclic1(int foo) = E.redirCyclic2; // Error. + ^"; +static inline-class-member method E|constructor#_#redirCyclic1#tearOff(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:13:11: Error: Cyclic definition of factory 'E.redirCyclic1'. + factory E.redirCyclic1(int foo) = E.redirCyclic2; // Error. + ^"; +static inline-class-member method E|constructor#redirCyclic2(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:14:11: Error: Cyclic definition of factory 'E.redirCyclic2'. + factory E.redirCyclic2(int foo) = E.redirCyclic1; // Error. + ^"; +static inline-class-member method E|constructor#_#redirCyclic2#tearOff(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:14:11: Error: Cyclic definition of factory 'E.redirCyclic2'. + factory E.redirCyclic2(int foo) = E.redirCyclic1; // Error. + ^"; +static inline-class-member method E|constructor#redirCyclicSelf(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:16:11: Error: Cyclic definition of factory 'E.redirCyclicSelf'. + factory E.redirCyclicSelf(int foo) = E.redirCyclicSelf; // Error. + ^"; +static inline-class-member method E|constructor#_#redirCyclicSelf#tearOff(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:16:11: Error: Cyclic definition of factory 'E.redirCyclicSelf'. + factory E.redirCyclicSelf(int foo) = E.redirCyclicSelf; // Error. + ^"; +static inline-class-member method GE|constructor#(self::GE|constructor#::X% foo) → self::GE /* = self::GE|constructor#::X% */ { + lowered final self::GE /* = self::GE|constructor#::X% */ #this = foo; + return #this; +} +static inline-class-member method GE|constructor#_#new#tearOff(self::GE|constructor#_#new#tearOff::X% foo) → self::GE% /* = self::GE|constructor#_#new#tearOff::X% */ + return self::GE|constructor#(foo); +static inline-class-member method GE|constructor#redirNotEnough1() → self::GE /* = self::GE|constructor#redirNotEnough1::X% */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:20:34: Error: The constructor function type 'GE Function(dynamic)' isn't a subtype of 'GE Function()'. + factory GE.redirNotEnough1() = GE; // Error. + ^"; +static inline-class-member method GE|constructor#_#redirNotEnough1#tearOff() → self::GE% /* = self::GE|constructor#_#redirNotEnough1#tearOff::X% */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:20:34: Error: The constructor function type 'GE Function(dynamic)' isn't a subtype of 'GE Function()'. + factory GE.redirNotEnough1() = GE; // Error. + ^"; +static inline-class-member method GE|constructor#redirNotEnough2() → self::GE /* = self::GE|constructor#redirNotEnough2::X% */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:20:34: Error: The constructor function type 'GE Function(dynamic)' isn't a subtype of 'GE Function()'. + factory GE.redirNotEnough1() = GE; // Error. + ^"; +static inline-class-member method GE|constructor#_#redirNotEnough2#tearOff() → self::GE% /* = self::GE|constructor#_#redirNotEnough2#tearOff::X% */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:20:34: Error: The constructor function type 'GE Function(dynamic)' isn't a subtype of 'GE Function()'. + factory GE.redirNotEnough1() = GE; // Error. + ^"; + +constants { + #C1 = null +} diff --git a/pkg/front_end/testcases/extension_types/issue53209.dart.strong.transformed.expect b/pkg/front_end/testcases/extension_types/issue53209.dart.strong.transformed.expect new file mode 100644 index 00000000000..4eaf39ce102 --- /dev/null +++ b/pkg/front_end/testcases/extension_types/issue53209.dart.strong.transformed.expect @@ -0,0 +1,172 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/extension_types/issue53209.dart:6:32: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function()'. +// factory E.redirNotEnough() = E; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:8:50: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String)'. +// factory E.redirTooMany1(int foo, String bar) = E; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:9:59: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String, num)'. +// factory E.redirTooMany2(int foo, String bar, num baz) = E; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:10:53: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, [dynamic])'. +// factory E.redirTooMany3(int foo, [dynamic bar]) = E; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:11:61: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, {Object bar})'. +// - 'Object' is from 'dart:core'. +// factory E.redirTooMany4(int foo, {required Object bar}) = E; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:13:11: Error: Cyclic definition of factory 'E.redirCyclic1'. +// factory E.redirCyclic1(int foo) = E.redirCyclic2; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:14:11: Error: Cyclic definition of factory 'E.redirCyclic2'. +// factory E.redirCyclic2(int foo) = E.redirCyclic1; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:16:11: Error: Cyclic definition of factory 'E.redirCyclicSelf'. +// factory E.redirCyclicSelf(int foo) = E.redirCyclicSelf; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:20:34: Error: The constructor function type 'GE Function(dynamic)' isn't a subtype of 'GE Function()'. +// factory GE.redirNotEnough1() = GE; // Error. +// ^ +// +import self as self; +import "dart:core" as core; + +extension type E(core::int foo) { + abstract inline-class-member representation-field get foo() → core::int; + constructor • = self::E|constructor#; + constructor tearoff • = self::E|constructor#_#new#tearOff; + static redirecting-factory redirNotEnough = self::E|constructor#redirNotEnough; + static redirecting-factory tearoff redirNotEnough = self::E|constructor#_#redirNotEnough#tearOff; + static redirecting-factory redirTooMany1 = self::E|constructor#redirTooMany1; + static redirecting-factory tearoff redirTooMany1 = self::E|constructor#_#redirTooMany1#tearOff; + static redirecting-factory redirTooMany2 = self::E|constructor#redirTooMany2; + static redirecting-factory tearoff redirTooMany2 = self::E|constructor#_#redirTooMany2#tearOff; + static redirecting-factory redirTooMany3 = self::E|constructor#redirTooMany3; + static redirecting-factory tearoff redirTooMany3 = self::E|constructor#_#redirTooMany3#tearOff; + static redirecting-factory redirTooMany4 = self::E|constructor#redirTooMany4; + static redirecting-factory tearoff redirTooMany4 = self::E|constructor#_#redirTooMany4#tearOff; + static redirecting-factory redirCyclic1 = self::E|constructor#redirCyclic1; + static redirecting-factory tearoff redirCyclic1 = self::E|constructor#_#redirCyclic1#tearOff; + static redirecting-factory redirCyclic2 = self::E|constructor#redirCyclic2; + static redirecting-factory tearoff redirCyclic2 = self::E|constructor#_#redirCyclic2#tearOff; + static redirecting-factory redirCyclicSelf = self::E|constructor#redirCyclicSelf; + static redirecting-factory tearoff redirCyclicSelf = self::E|constructor#_#redirCyclicSelf#tearOff; +} +extension type GE(X% foo) { + abstract inline-class-member representation-field get foo() → X%; + constructor • = self::GE|constructor#; + constructor tearoff • = self::GE|constructor#_#new#tearOff; + static redirecting-factory redirNotEnough1 = self::GE|constructor#redirNotEnough1; + static redirecting-factory tearoff redirNotEnough1 = self::GE|constructor#_#redirNotEnough1#tearOff; + static redirecting-factory redirNotEnough2 = self::GE|constructor#redirNotEnough2; + static redirecting-factory tearoff redirNotEnough2 = self::GE|constructor#_#redirNotEnough2#tearOff; +} +static inline-class-member method E|constructor#(core::int foo) → self::E /* = core::int */ { + lowered final self::E /* = core::int */ #this = foo; + return #this; +} +static inline-class-member method E|constructor#_#new#tearOff(core::int foo) → self::E /* = core::int */ + return self::E|constructor#(foo); +static inline-class-member method E|constructor#redirNotEnough() → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:6:32: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function()'. + factory E.redirNotEnough() = E; // Error. + ^"; +static inline-class-member method E|constructor#_#redirNotEnough#tearOff() → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:6:32: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function()'. + factory E.redirNotEnough() = E; // Error. + ^"; +static inline-class-member method E|constructor#redirTooMany1(core::int foo, core::String bar = #C1) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:8:50: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String)'. + factory E.redirTooMany1(int foo, String bar) = E; // Error. + ^"; +static inline-class-member method E|constructor#_#redirTooMany1#tearOff(core::int foo, core::String bar = #C1) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:8:50: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String)'. + factory E.redirTooMany1(int foo, String bar) = E; // Error. + ^"; +static inline-class-member method E|constructor#redirTooMany2(core::int foo, core::String bar = #C1, core::num baz = #C1) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:9:59: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String, num)'. + factory E.redirTooMany2(int foo, String bar, num baz) = E; // Error. + ^"; +static inline-class-member method E|constructor#_#redirTooMany2#tearOff(core::int foo, core::String bar = #C1, core::num baz = #C1) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:9:59: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String, num)'. + factory E.redirTooMany2(int foo, String bar, num baz) = E; // Error. + ^"; +static inline-class-member method E|constructor#redirTooMany3(core::int foo, [dynamic bar = #C1]) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:10:53: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, [dynamic])'. + factory E.redirTooMany3(int foo, [dynamic bar]) = E; // Error. + ^"; +static inline-class-member method E|constructor#_#redirTooMany3#tearOff(core::int foo, [dynamic bar = #C1]) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:10:53: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, [dynamic])'. + factory E.redirTooMany3(int foo, [dynamic bar]) = E; // Error. + ^"; +static inline-class-member method E|constructor#redirTooMany4(core::int foo, {required core::Object bar = #C1}) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:11:61: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, {Object bar})'. + - 'Object' is from 'dart:core'. + factory E.redirTooMany4(int foo, {required Object bar}) = E; // Error. + ^"; +static inline-class-member method E|constructor#_#redirTooMany4#tearOff(core::int foo, {required core::Object bar = #C1}) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:11:61: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, {Object bar})'. + - 'Object' is from 'dart:core'. + factory E.redirTooMany4(int foo, {required Object bar}) = E; // Error. + ^"; +static inline-class-member method E|constructor#redirCyclic1(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:13:11: Error: Cyclic definition of factory 'E.redirCyclic1'. + factory E.redirCyclic1(int foo) = E.redirCyclic2; // Error. + ^"; +static inline-class-member method E|constructor#_#redirCyclic1#tearOff(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:13:11: Error: Cyclic definition of factory 'E.redirCyclic1'. + factory E.redirCyclic1(int foo) = E.redirCyclic2; // Error. + ^"; +static inline-class-member method E|constructor#redirCyclic2(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:14:11: Error: Cyclic definition of factory 'E.redirCyclic2'. + factory E.redirCyclic2(int foo) = E.redirCyclic1; // Error. + ^"; +static inline-class-member method E|constructor#_#redirCyclic2#tearOff(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:14:11: Error: Cyclic definition of factory 'E.redirCyclic2'. + factory E.redirCyclic2(int foo) = E.redirCyclic1; // Error. + ^"; +static inline-class-member method E|constructor#redirCyclicSelf(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:16:11: Error: Cyclic definition of factory 'E.redirCyclicSelf'. + factory E.redirCyclicSelf(int foo) = E.redirCyclicSelf; // Error. + ^"; +static inline-class-member method E|constructor#_#redirCyclicSelf#tearOff(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:16:11: Error: Cyclic definition of factory 'E.redirCyclicSelf'. + factory E.redirCyclicSelf(int foo) = E.redirCyclicSelf; // Error. + ^"; +static inline-class-member method GE|constructor#(self::GE|constructor#::X% foo) → self::GE /* = self::GE|constructor#::X% */ { + lowered final self::GE /* = self::GE|constructor#::X% */ #this = foo; + return #this; +} +static inline-class-member method GE|constructor#_#new#tearOff(self::GE|constructor#_#new#tearOff::X% foo) → self::GE% /* = self::GE|constructor#_#new#tearOff::X% */ + return self::GE|constructor#(foo); +static inline-class-member method GE|constructor#redirNotEnough1() → self::GE /* = self::GE|constructor#redirNotEnough1::X% */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:20:34: Error: The constructor function type 'GE Function(dynamic)' isn't a subtype of 'GE Function()'. + factory GE.redirNotEnough1() = GE; // Error. + ^"; +static inline-class-member method GE|constructor#_#redirNotEnough1#tearOff() → self::GE% /* = self::GE|constructor#_#redirNotEnough1#tearOff::X% */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:20:34: Error: The constructor function type 'GE Function(dynamic)' isn't a subtype of 'GE Function()'. + factory GE.redirNotEnough1() = GE; // Error. + ^"; +static inline-class-member method GE|constructor#redirNotEnough2() → self::GE /* = self::GE|constructor#redirNotEnough2::X% */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:20:34: Error: The constructor function type 'GE Function(dynamic)' isn't a subtype of 'GE Function()'. + factory GE.redirNotEnough1() = GE; // Error. + ^"; +static inline-class-member method GE|constructor#_#redirNotEnough2#tearOff() → self::GE% /* = self::GE|constructor#_#redirNotEnough2#tearOff::X% */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:20:34: Error: The constructor function type 'GE Function(dynamic)' isn't a subtype of 'GE Function()'. + factory GE.redirNotEnough1() = GE; // Error. + ^"; + +constants { + #C1 = null +} diff --git a/pkg/front_end/testcases/extension_types/issue53209.dart.textual_outline.expect b/pkg/front_end/testcases/extension_types/issue53209.dart.textual_outline.expect new file mode 100644 index 00000000000..36785fb2a1c --- /dev/null +++ b/pkg/front_end/testcases/extension_types/issue53209.dart.textual_outline.expect @@ -0,0 +1,14 @@ +extension type E(int foo) { + factory E.redirNotEnough() = E; + factory E.redirTooMany1(int foo, String bar) = E; + factory E.redirTooMany2(int foo, String bar, num baz) = E; + factory E.redirTooMany3(int foo, [dynamic bar]) = E; + factory E.redirTooMany4(int foo, {required Object bar}) = E; + factory E.redirCyclic1(int foo) = E.redirCyclic2; + factory E.redirCyclic2(int foo) = E.redirCyclic1; + factory E.redirCyclicSelf(int foo) = E.redirCyclicSelf; +} +extension type GE(X foo) { + factory GE.redirNotEnough1() = GE; + factory GE.redirNotEnough2() = GE.redirNotEnough1; +} diff --git a/pkg/front_end/testcases/extension_types/issue53209.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/extension_types/issue53209.dart.textual_outline_modelled.expect new file mode 100644 index 00000000000..5115a76df99 --- /dev/null +++ b/pkg/front_end/testcases/extension_types/issue53209.dart.textual_outline_modelled.expect @@ -0,0 +1,14 @@ +extension type E(int foo) { + factory E.redirCyclic1(int foo) = E.redirCyclic2; + factory E.redirCyclic2(int foo) = E.redirCyclic1; + factory E.redirCyclicSelf(int foo) = E.redirCyclicSelf; + factory E.redirNotEnough() = E; + factory E.redirTooMany1(int foo, String bar) = E; + factory E.redirTooMany2(int foo, String bar, num baz) = E; + factory E.redirTooMany3(int foo, [dynamic bar]) = E; + factory E.redirTooMany4(int foo, {required Object bar}) = E; +} +extension type GE(X foo) { + factory GE.redirNotEnough1() = GE; + factory GE.redirNotEnough2() = GE.redirNotEnough1; +} diff --git a/pkg/front_end/testcases/extension_types/issue53209.dart.weak.expect b/pkg/front_end/testcases/extension_types/issue53209.dart.weak.expect new file mode 100644 index 00000000000..4eaf39ce102 --- /dev/null +++ b/pkg/front_end/testcases/extension_types/issue53209.dart.weak.expect @@ -0,0 +1,172 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/extension_types/issue53209.dart:6:32: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function()'. +// factory E.redirNotEnough() = E; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:8:50: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String)'. +// factory E.redirTooMany1(int foo, String bar) = E; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:9:59: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String, num)'. +// factory E.redirTooMany2(int foo, String bar, num baz) = E; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:10:53: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, [dynamic])'. +// factory E.redirTooMany3(int foo, [dynamic bar]) = E; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:11:61: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, {Object bar})'. +// - 'Object' is from 'dart:core'. +// factory E.redirTooMany4(int foo, {required Object bar}) = E; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:13:11: Error: Cyclic definition of factory 'E.redirCyclic1'. +// factory E.redirCyclic1(int foo) = E.redirCyclic2; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:14:11: Error: Cyclic definition of factory 'E.redirCyclic2'. +// factory E.redirCyclic2(int foo) = E.redirCyclic1; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:16:11: Error: Cyclic definition of factory 'E.redirCyclicSelf'. +// factory E.redirCyclicSelf(int foo) = E.redirCyclicSelf; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:20:34: Error: The constructor function type 'GE Function(dynamic)' isn't a subtype of 'GE Function()'. +// factory GE.redirNotEnough1() = GE; // Error. +// ^ +// +import self as self; +import "dart:core" as core; + +extension type E(core::int foo) { + abstract inline-class-member representation-field get foo() → core::int; + constructor • = self::E|constructor#; + constructor tearoff • = self::E|constructor#_#new#tearOff; + static redirecting-factory redirNotEnough = self::E|constructor#redirNotEnough; + static redirecting-factory tearoff redirNotEnough = self::E|constructor#_#redirNotEnough#tearOff; + static redirecting-factory redirTooMany1 = self::E|constructor#redirTooMany1; + static redirecting-factory tearoff redirTooMany1 = self::E|constructor#_#redirTooMany1#tearOff; + static redirecting-factory redirTooMany2 = self::E|constructor#redirTooMany2; + static redirecting-factory tearoff redirTooMany2 = self::E|constructor#_#redirTooMany2#tearOff; + static redirecting-factory redirTooMany3 = self::E|constructor#redirTooMany3; + static redirecting-factory tearoff redirTooMany3 = self::E|constructor#_#redirTooMany3#tearOff; + static redirecting-factory redirTooMany4 = self::E|constructor#redirTooMany4; + static redirecting-factory tearoff redirTooMany4 = self::E|constructor#_#redirTooMany4#tearOff; + static redirecting-factory redirCyclic1 = self::E|constructor#redirCyclic1; + static redirecting-factory tearoff redirCyclic1 = self::E|constructor#_#redirCyclic1#tearOff; + static redirecting-factory redirCyclic2 = self::E|constructor#redirCyclic2; + static redirecting-factory tearoff redirCyclic2 = self::E|constructor#_#redirCyclic2#tearOff; + static redirecting-factory redirCyclicSelf = self::E|constructor#redirCyclicSelf; + static redirecting-factory tearoff redirCyclicSelf = self::E|constructor#_#redirCyclicSelf#tearOff; +} +extension type GE(X% foo) { + abstract inline-class-member representation-field get foo() → X%; + constructor • = self::GE|constructor#; + constructor tearoff • = self::GE|constructor#_#new#tearOff; + static redirecting-factory redirNotEnough1 = self::GE|constructor#redirNotEnough1; + static redirecting-factory tearoff redirNotEnough1 = self::GE|constructor#_#redirNotEnough1#tearOff; + static redirecting-factory redirNotEnough2 = self::GE|constructor#redirNotEnough2; + static redirecting-factory tearoff redirNotEnough2 = self::GE|constructor#_#redirNotEnough2#tearOff; +} +static inline-class-member method E|constructor#(core::int foo) → self::E /* = core::int */ { + lowered final self::E /* = core::int */ #this = foo; + return #this; +} +static inline-class-member method E|constructor#_#new#tearOff(core::int foo) → self::E /* = core::int */ + return self::E|constructor#(foo); +static inline-class-member method E|constructor#redirNotEnough() → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:6:32: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function()'. + factory E.redirNotEnough() = E; // Error. + ^"; +static inline-class-member method E|constructor#_#redirNotEnough#tearOff() → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:6:32: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function()'. + factory E.redirNotEnough() = E; // Error. + ^"; +static inline-class-member method E|constructor#redirTooMany1(core::int foo, core::String bar = #C1) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:8:50: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String)'. + factory E.redirTooMany1(int foo, String bar) = E; // Error. + ^"; +static inline-class-member method E|constructor#_#redirTooMany1#tearOff(core::int foo, core::String bar = #C1) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:8:50: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String)'. + factory E.redirTooMany1(int foo, String bar) = E; // Error. + ^"; +static inline-class-member method E|constructor#redirTooMany2(core::int foo, core::String bar = #C1, core::num baz = #C1) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:9:59: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String, num)'. + factory E.redirTooMany2(int foo, String bar, num baz) = E; // Error. + ^"; +static inline-class-member method E|constructor#_#redirTooMany2#tearOff(core::int foo, core::String bar = #C1, core::num baz = #C1) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:9:59: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String, num)'. + factory E.redirTooMany2(int foo, String bar, num baz) = E; // Error. + ^"; +static inline-class-member method E|constructor#redirTooMany3(core::int foo, [dynamic bar = #C1]) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:10:53: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, [dynamic])'. + factory E.redirTooMany3(int foo, [dynamic bar]) = E; // Error. + ^"; +static inline-class-member method E|constructor#_#redirTooMany3#tearOff(core::int foo, [dynamic bar = #C1]) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:10:53: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, [dynamic])'. + factory E.redirTooMany3(int foo, [dynamic bar]) = E; // Error. + ^"; +static inline-class-member method E|constructor#redirTooMany4(core::int foo, {required core::Object bar = #C1}) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:11:61: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, {Object bar})'. + - 'Object' is from 'dart:core'. + factory E.redirTooMany4(int foo, {required Object bar}) = E; // Error. + ^"; +static inline-class-member method E|constructor#_#redirTooMany4#tearOff(core::int foo, {required core::Object bar = #C1}) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:11:61: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, {Object bar})'. + - 'Object' is from 'dart:core'. + factory E.redirTooMany4(int foo, {required Object bar}) = E; // Error. + ^"; +static inline-class-member method E|constructor#redirCyclic1(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:13:11: Error: Cyclic definition of factory 'E.redirCyclic1'. + factory E.redirCyclic1(int foo) = E.redirCyclic2; // Error. + ^"; +static inline-class-member method E|constructor#_#redirCyclic1#tearOff(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:13:11: Error: Cyclic definition of factory 'E.redirCyclic1'. + factory E.redirCyclic1(int foo) = E.redirCyclic2; // Error. + ^"; +static inline-class-member method E|constructor#redirCyclic2(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:14:11: Error: Cyclic definition of factory 'E.redirCyclic2'. + factory E.redirCyclic2(int foo) = E.redirCyclic1; // Error. + ^"; +static inline-class-member method E|constructor#_#redirCyclic2#tearOff(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:14:11: Error: Cyclic definition of factory 'E.redirCyclic2'. + factory E.redirCyclic2(int foo) = E.redirCyclic1; // Error. + ^"; +static inline-class-member method E|constructor#redirCyclicSelf(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:16:11: Error: Cyclic definition of factory 'E.redirCyclicSelf'. + factory E.redirCyclicSelf(int foo) = E.redirCyclicSelf; // Error. + ^"; +static inline-class-member method E|constructor#_#redirCyclicSelf#tearOff(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:16:11: Error: Cyclic definition of factory 'E.redirCyclicSelf'. + factory E.redirCyclicSelf(int foo) = E.redirCyclicSelf; // Error. + ^"; +static inline-class-member method GE|constructor#(self::GE|constructor#::X% foo) → self::GE /* = self::GE|constructor#::X% */ { + lowered final self::GE /* = self::GE|constructor#::X% */ #this = foo; + return #this; +} +static inline-class-member method GE|constructor#_#new#tearOff(self::GE|constructor#_#new#tearOff::X% foo) → self::GE% /* = self::GE|constructor#_#new#tearOff::X% */ + return self::GE|constructor#(foo); +static inline-class-member method GE|constructor#redirNotEnough1() → self::GE /* = self::GE|constructor#redirNotEnough1::X% */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:20:34: Error: The constructor function type 'GE Function(dynamic)' isn't a subtype of 'GE Function()'. + factory GE.redirNotEnough1() = GE; // Error. + ^"; +static inline-class-member method GE|constructor#_#redirNotEnough1#tearOff() → self::GE% /* = self::GE|constructor#_#redirNotEnough1#tearOff::X% */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:20:34: Error: The constructor function type 'GE Function(dynamic)' isn't a subtype of 'GE Function()'. + factory GE.redirNotEnough1() = GE; // Error. + ^"; +static inline-class-member method GE|constructor#redirNotEnough2() → self::GE /* = self::GE|constructor#redirNotEnough2::X% */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:20:34: Error: The constructor function type 'GE Function(dynamic)' isn't a subtype of 'GE Function()'. + factory GE.redirNotEnough1() = GE; // Error. + ^"; +static inline-class-member method GE|constructor#_#redirNotEnough2#tearOff() → self::GE% /* = self::GE|constructor#_#redirNotEnough2#tearOff::X% */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:20:34: Error: The constructor function type 'GE Function(dynamic)' isn't a subtype of 'GE Function()'. + factory GE.redirNotEnough1() = GE; // Error. + ^"; + +constants { + #C1 = null +} diff --git a/pkg/front_end/testcases/extension_types/issue53209.dart.weak.modular.expect b/pkg/front_end/testcases/extension_types/issue53209.dart.weak.modular.expect new file mode 100644 index 00000000000..4eaf39ce102 --- /dev/null +++ b/pkg/front_end/testcases/extension_types/issue53209.dart.weak.modular.expect @@ -0,0 +1,172 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/extension_types/issue53209.dart:6:32: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function()'. +// factory E.redirNotEnough() = E; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:8:50: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String)'. +// factory E.redirTooMany1(int foo, String bar) = E; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:9:59: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String, num)'. +// factory E.redirTooMany2(int foo, String bar, num baz) = E; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:10:53: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, [dynamic])'. +// factory E.redirTooMany3(int foo, [dynamic bar]) = E; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:11:61: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, {Object bar})'. +// - 'Object' is from 'dart:core'. +// factory E.redirTooMany4(int foo, {required Object bar}) = E; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:13:11: Error: Cyclic definition of factory 'E.redirCyclic1'. +// factory E.redirCyclic1(int foo) = E.redirCyclic2; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:14:11: Error: Cyclic definition of factory 'E.redirCyclic2'. +// factory E.redirCyclic2(int foo) = E.redirCyclic1; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:16:11: Error: Cyclic definition of factory 'E.redirCyclicSelf'. +// factory E.redirCyclicSelf(int foo) = E.redirCyclicSelf; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:20:34: Error: The constructor function type 'GE Function(dynamic)' isn't a subtype of 'GE Function()'. +// factory GE.redirNotEnough1() = GE; // Error. +// ^ +// +import self as self; +import "dart:core" as core; + +extension type E(core::int foo) { + abstract inline-class-member representation-field get foo() → core::int; + constructor • = self::E|constructor#; + constructor tearoff • = self::E|constructor#_#new#tearOff; + static redirecting-factory redirNotEnough = self::E|constructor#redirNotEnough; + static redirecting-factory tearoff redirNotEnough = self::E|constructor#_#redirNotEnough#tearOff; + static redirecting-factory redirTooMany1 = self::E|constructor#redirTooMany1; + static redirecting-factory tearoff redirTooMany1 = self::E|constructor#_#redirTooMany1#tearOff; + static redirecting-factory redirTooMany2 = self::E|constructor#redirTooMany2; + static redirecting-factory tearoff redirTooMany2 = self::E|constructor#_#redirTooMany2#tearOff; + static redirecting-factory redirTooMany3 = self::E|constructor#redirTooMany3; + static redirecting-factory tearoff redirTooMany3 = self::E|constructor#_#redirTooMany3#tearOff; + static redirecting-factory redirTooMany4 = self::E|constructor#redirTooMany4; + static redirecting-factory tearoff redirTooMany4 = self::E|constructor#_#redirTooMany4#tearOff; + static redirecting-factory redirCyclic1 = self::E|constructor#redirCyclic1; + static redirecting-factory tearoff redirCyclic1 = self::E|constructor#_#redirCyclic1#tearOff; + static redirecting-factory redirCyclic2 = self::E|constructor#redirCyclic2; + static redirecting-factory tearoff redirCyclic2 = self::E|constructor#_#redirCyclic2#tearOff; + static redirecting-factory redirCyclicSelf = self::E|constructor#redirCyclicSelf; + static redirecting-factory tearoff redirCyclicSelf = self::E|constructor#_#redirCyclicSelf#tearOff; +} +extension type GE(X% foo) { + abstract inline-class-member representation-field get foo() → X%; + constructor • = self::GE|constructor#; + constructor tearoff • = self::GE|constructor#_#new#tearOff; + static redirecting-factory redirNotEnough1 = self::GE|constructor#redirNotEnough1; + static redirecting-factory tearoff redirNotEnough1 = self::GE|constructor#_#redirNotEnough1#tearOff; + static redirecting-factory redirNotEnough2 = self::GE|constructor#redirNotEnough2; + static redirecting-factory tearoff redirNotEnough2 = self::GE|constructor#_#redirNotEnough2#tearOff; +} +static inline-class-member method E|constructor#(core::int foo) → self::E /* = core::int */ { + lowered final self::E /* = core::int */ #this = foo; + return #this; +} +static inline-class-member method E|constructor#_#new#tearOff(core::int foo) → self::E /* = core::int */ + return self::E|constructor#(foo); +static inline-class-member method E|constructor#redirNotEnough() → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:6:32: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function()'. + factory E.redirNotEnough() = E; // Error. + ^"; +static inline-class-member method E|constructor#_#redirNotEnough#tearOff() → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:6:32: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function()'. + factory E.redirNotEnough() = E; // Error. + ^"; +static inline-class-member method E|constructor#redirTooMany1(core::int foo, core::String bar = #C1) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:8:50: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String)'. + factory E.redirTooMany1(int foo, String bar) = E; // Error. + ^"; +static inline-class-member method E|constructor#_#redirTooMany1#tearOff(core::int foo, core::String bar = #C1) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:8:50: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String)'. + factory E.redirTooMany1(int foo, String bar) = E; // Error. + ^"; +static inline-class-member method E|constructor#redirTooMany2(core::int foo, core::String bar = #C1, core::num baz = #C1) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:9:59: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String, num)'. + factory E.redirTooMany2(int foo, String bar, num baz) = E; // Error. + ^"; +static inline-class-member method E|constructor#_#redirTooMany2#tearOff(core::int foo, core::String bar = #C1, core::num baz = #C1) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:9:59: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String, num)'. + factory E.redirTooMany2(int foo, String bar, num baz) = E; // Error. + ^"; +static inline-class-member method E|constructor#redirTooMany3(core::int foo, [dynamic bar = #C1]) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:10:53: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, [dynamic])'. + factory E.redirTooMany3(int foo, [dynamic bar]) = E; // Error. + ^"; +static inline-class-member method E|constructor#_#redirTooMany3#tearOff(core::int foo, [dynamic bar = #C1]) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:10:53: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, [dynamic])'. + factory E.redirTooMany3(int foo, [dynamic bar]) = E; // Error. + ^"; +static inline-class-member method E|constructor#redirTooMany4(core::int foo, {required core::Object bar = #C1}) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:11:61: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, {Object bar})'. + - 'Object' is from 'dart:core'. + factory E.redirTooMany4(int foo, {required Object bar}) = E; // Error. + ^"; +static inline-class-member method E|constructor#_#redirTooMany4#tearOff(core::int foo, {required core::Object bar = #C1}) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:11:61: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, {Object bar})'. + - 'Object' is from 'dart:core'. + factory E.redirTooMany4(int foo, {required Object bar}) = E; // Error. + ^"; +static inline-class-member method E|constructor#redirCyclic1(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:13:11: Error: Cyclic definition of factory 'E.redirCyclic1'. + factory E.redirCyclic1(int foo) = E.redirCyclic2; // Error. + ^"; +static inline-class-member method E|constructor#_#redirCyclic1#tearOff(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:13:11: Error: Cyclic definition of factory 'E.redirCyclic1'. + factory E.redirCyclic1(int foo) = E.redirCyclic2; // Error. + ^"; +static inline-class-member method E|constructor#redirCyclic2(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:14:11: Error: Cyclic definition of factory 'E.redirCyclic2'. + factory E.redirCyclic2(int foo) = E.redirCyclic1; // Error. + ^"; +static inline-class-member method E|constructor#_#redirCyclic2#tearOff(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:14:11: Error: Cyclic definition of factory 'E.redirCyclic2'. + factory E.redirCyclic2(int foo) = E.redirCyclic1; // Error. + ^"; +static inline-class-member method E|constructor#redirCyclicSelf(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:16:11: Error: Cyclic definition of factory 'E.redirCyclicSelf'. + factory E.redirCyclicSelf(int foo) = E.redirCyclicSelf; // Error. + ^"; +static inline-class-member method E|constructor#_#redirCyclicSelf#tearOff(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:16:11: Error: Cyclic definition of factory 'E.redirCyclicSelf'. + factory E.redirCyclicSelf(int foo) = E.redirCyclicSelf; // Error. + ^"; +static inline-class-member method GE|constructor#(self::GE|constructor#::X% foo) → self::GE /* = self::GE|constructor#::X% */ { + lowered final self::GE /* = self::GE|constructor#::X% */ #this = foo; + return #this; +} +static inline-class-member method GE|constructor#_#new#tearOff(self::GE|constructor#_#new#tearOff::X% foo) → self::GE% /* = self::GE|constructor#_#new#tearOff::X% */ + return self::GE|constructor#(foo); +static inline-class-member method GE|constructor#redirNotEnough1() → self::GE /* = self::GE|constructor#redirNotEnough1::X% */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:20:34: Error: The constructor function type 'GE Function(dynamic)' isn't a subtype of 'GE Function()'. + factory GE.redirNotEnough1() = GE; // Error. + ^"; +static inline-class-member method GE|constructor#_#redirNotEnough1#tearOff() → self::GE% /* = self::GE|constructor#_#redirNotEnough1#tearOff::X% */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:20:34: Error: The constructor function type 'GE Function(dynamic)' isn't a subtype of 'GE Function()'. + factory GE.redirNotEnough1() = GE; // Error. + ^"; +static inline-class-member method GE|constructor#redirNotEnough2() → self::GE /* = self::GE|constructor#redirNotEnough2::X% */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:20:34: Error: The constructor function type 'GE Function(dynamic)' isn't a subtype of 'GE Function()'. + factory GE.redirNotEnough1() = GE; // Error. + ^"; +static inline-class-member method GE|constructor#_#redirNotEnough2#tearOff() → self::GE% /* = self::GE|constructor#_#redirNotEnough2#tearOff::X% */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:20:34: Error: The constructor function type 'GE Function(dynamic)' isn't a subtype of 'GE Function()'. + factory GE.redirNotEnough1() = GE; // Error. + ^"; + +constants { + #C1 = null +} diff --git a/pkg/front_end/testcases/extension_types/issue53209.dart.weak.outline.expect b/pkg/front_end/testcases/extension_types/issue53209.dart.weak.outline.expect new file mode 100644 index 00000000000..84f29e825c6 --- /dev/null +++ b/pkg/front_end/testcases/extension_types/issue53209.dart.weak.outline.expect @@ -0,0 +1,164 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/extension_types/issue53209.dart:6:32: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function()'. +// factory E.redirNotEnough() = E; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:8:50: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String)'. +// factory E.redirTooMany1(int foo, String bar) = E; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:9:59: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String, num)'. +// factory E.redirTooMany2(int foo, String bar, num baz) = E; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:10:53: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, [dynamic])'. +// factory E.redirTooMany3(int foo, [dynamic bar]) = E; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:11:61: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, {Object bar})'. +// - 'Object' is from 'dart:core'. +// factory E.redirTooMany4(int foo, {required Object bar}) = E; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:13:11: Error: Cyclic definition of factory 'E.redirCyclic1'. +// factory E.redirCyclic1(int foo) = E.redirCyclic2; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:14:11: Error: Cyclic definition of factory 'E.redirCyclic2'. +// factory E.redirCyclic2(int foo) = E.redirCyclic1; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:16:11: Error: Cyclic definition of factory 'E.redirCyclicSelf'. +// factory E.redirCyclicSelf(int foo) = E.redirCyclicSelf; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:20:34: Error: The constructor function type 'GE Function(dynamic)' isn't a subtype of 'GE Function()'. +// factory GE.redirNotEnough1() = GE; // Error. +// ^ +// +import self as self; +import "dart:core" as core; + +extension type E(core::int foo) { + abstract inline-class-member representation-field get foo() → core::int; + constructor • = self::E|constructor#; + constructor tearoff • = self::E|constructor#_#new#tearOff; + static redirecting-factory redirNotEnough = self::E|constructor#redirNotEnough; + static redirecting-factory tearoff redirNotEnough = self::E|constructor#_#redirNotEnough#tearOff; + static redirecting-factory redirTooMany1 = self::E|constructor#redirTooMany1; + static redirecting-factory tearoff redirTooMany1 = self::E|constructor#_#redirTooMany1#tearOff; + static redirecting-factory redirTooMany2 = self::E|constructor#redirTooMany2; + static redirecting-factory tearoff redirTooMany2 = self::E|constructor#_#redirTooMany2#tearOff; + static redirecting-factory redirTooMany3 = self::E|constructor#redirTooMany3; + static redirecting-factory tearoff redirTooMany3 = self::E|constructor#_#redirTooMany3#tearOff; + static redirecting-factory redirTooMany4 = self::E|constructor#redirTooMany4; + static redirecting-factory tearoff redirTooMany4 = self::E|constructor#_#redirTooMany4#tearOff; + static redirecting-factory redirCyclic1 = self::E|constructor#redirCyclic1; + static redirecting-factory tearoff redirCyclic1 = self::E|constructor#_#redirCyclic1#tearOff; + static redirecting-factory redirCyclic2 = self::E|constructor#redirCyclic2; + static redirecting-factory tearoff redirCyclic2 = self::E|constructor#_#redirCyclic2#tearOff; + static redirecting-factory redirCyclicSelf = self::E|constructor#redirCyclicSelf; + static redirecting-factory tearoff redirCyclicSelf = self::E|constructor#_#redirCyclicSelf#tearOff; +} +extension type GE(X% foo) { + abstract inline-class-member representation-field get foo() → X%; + constructor • = self::GE|constructor#; + constructor tearoff • = self::GE|constructor#_#new#tearOff; + static redirecting-factory redirNotEnough1 = self::GE|constructor#redirNotEnough1; + static redirecting-factory tearoff redirNotEnough1 = self::GE|constructor#_#redirNotEnough1#tearOff; + static redirecting-factory redirNotEnough2 = self::GE|constructor#redirNotEnough2; + static redirecting-factory tearoff redirNotEnough2 = self::GE|constructor#_#redirNotEnough2#tearOff; +} +static inline-class-member method E|constructor#(core::int foo) → self::E /* = core::int */ + ; +static inline-class-member method E|constructor#_#new#tearOff(core::int foo) → self::E /* = core::int */ + return self::E|constructor#(foo); +static inline-class-member method E|constructor#redirNotEnough() → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:6:32: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function()'. + factory E.redirNotEnough() = E; // Error. + ^"; +static inline-class-member method E|constructor#_#redirNotEnough#tearOff() → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:6:32: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function()'. + factory E.redirNotEnough() = E; // Error. + ^"; +static inline-class-member method E|constructor#redirTooMany1(core::int foo, core::String bar) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:8:50: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String)'. + factory E.redirTooMany1(int foo, String bar) = E; // Error. + ^"; +static inline-class-member method E|constructor#_#redirTooMany1#tearOff(core::int foo, core::String bar) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:8:50: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String)'. + factory E.redirTooMany1(int foo, String bar) = E; // Error. + ^"; +static inline-class-member method E|constructor#redirTooMany2(core::int foo, core::String bar, core::num baz) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:9:59: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String, num)'. + factory E.redirTooMany2(int foo, String bar, num baz) = E; // Error. + ^"; +static inline-class-member method E|constructor#_#redirTooMany2#tearOff(core::int foo, core::String bar, core::num baz) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:9:59: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String, num)'. + factory E.redirTooMany2(int foo, String bar, num baz) = E; // Error. + ^"; +static inline-class-member method E|constructor#redirTooMany3(core::int foo, [dynamic bar]) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:10:53: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, [dynamic])'. + factory E.redirTooMany3(int foo, [dynamic bar]) = E; // Error. + ^"; +static inline-class-member method E|constructor#_#redirTooMany3#tearOff(core::int foo, [dynamic bar]) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:10:53: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, [dynamic])'. + factory E.redirTooMany3(int foo, [dynamic bar]) = E; // Error. + ^"; +static inline-class-member method E|constructor#redirTooMany4(core::int foo, {required core::Object bar}) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:11:61: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, {Object bar})'. + - 'Object' is from 'dart:core'. + factory E.redirTooMany4(int foo, {required Object bar}) = E; // Error. + ^"; +static inline-class-member method E|constructor#_#redirTooMany4#tearOff(core::int foo, {required core::Object bar}) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:11:61: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, {Object bar})'. + - 'Object' is from 'dart:core'. + factory E.redirTooMany4(int foo, {required Object bar}) = E; // Error. + ^"; +static inline-class-member method E|constructor#redirCyclic1(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:13:11: Error: Cyclic definition of factory 'E.redirCyclic1'. + factory E.redirCyclic1(int foo) = E.redirCyclic2; // Error. + ^"; +static inline-class-member method E|constructor#_#redirCyclic1#tearOff(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:13:11: Error: Cyclic definition of factory 'E.redirCyclic1'. + factory E.redirCyclic1(int foo) = E.redirCyclic2; // Error. + ^"; +static inline-class-member method E|constructor#redirCyclic2(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:14:11: Error: Cyclic definition of factory 'E.redirCyclic2'. + factory E.redirCyclic2(int foo) = E.redirCyclic1; // Error. + ^"; +static inline-class-member method E|constructor#_#redirCyclic2#tearOff(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:14:11: Error: Cyclic definition of factory 'E.redirCyclic2'. + factory E.redirCyclic2(int foo) = E.redirCyclic1; // Error. + ^"; +static inline-class-member method E|constructor#redirCyclicSelf(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:16:11: Error: Cyclic definition of factory 'E.redirCyclicSelf'. + factory E.redirCyclicSelf(int foo) = E.redirCyclicSelf; // Error. + ^"; +static inline-class-member method E|constructor#_#redirCyclicSelf#tearOff(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:16:11: Error: Cyclic definition of factory 'E.redirCyclicSelf'. + factory E.redirCyclicSelf(int foo) = E.redirCyclicSelf; // Error. + ^"; +static inline-class-member method GE|constructor#(self::GE|constructor#::X% foo) → self::GE /* = self::GE|constructor#::X% */ + ; +static inline-class-member method GE|constructor#_#new#tearOff(self::GE|constructor#_#new#tearOff::X% foo) → self::GE% /* = self::GE|constructor#_#new#tearOff::X% */ + return self::GE|constructor#(foo); +static inline-class-member method GE|constructor#redirNotEnough1() → self::GE /* = self::GE|constructor#redirNotEnough1::X% */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:20:34: Error: The constructor function type 'GE Function(dynamic)' isn't a subtype of 'GE Function()'. + factory GE.redirNotEnough1() = GE; // Error. + ^"; +static inline-class-member method GE|constructor#_#redirNotEnough1#tearOff() → self::GE% /* = self::GE|constructor#_#redirNotEnough1#tearOff::X% */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:20:34: Error: The constructor function type 'GE Function(dynamic)' isn't a subtype of 'GE Function()'. + factory GE.redirNotEnough1() = GE; // Error. + ^"; +static inline-class-member method GE|constructor#redirNotEnough2() → self::GE /* = self::GE|constructor#redirNotEnough2::X% */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:20:34: Error: The constructor function type 'GE Function(dynamic)' isn't a subtype of 'GE Function()'. + factory GE.redirNotEnough1() = GE; // Error. + ^"; +static inline-class-member method GE|constructor#_#redirNotEnough2#tearOff() → self::GE% /* = self::GE|constructor#_#redirNotEnough2#tearOff::X% */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:20:34: Error: The constructor function type 'GE Function(dynamic)' isn't a subtype of 'GE Function()'. + factory GE.redirNotEnough1() = GE; // Error. + ^"; diff --git a/pkg/front_end/testcases/extension_types/issue53209.dart.weak.transformed.expect b/pkg/front_end/testcases/extension_types/issue53209.dart.weak.transformed.expect new file mode 100644 index 00000000000..4eaf39ce102 --- /dev/null +++ b/pkg/front_end/testcases/extension_types/issue53209.dart.weak.transformed.expect @@ -0,0 +1,172 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/extension_types/issue53209.dart:6:32: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function()'. +// factory E.redirNotEnough() = E; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:8:50: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String)'. +// factory E.redirTooMany1(int foo, String bar) = E; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:9:59: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String, num)'. +// factory E.redirTooMany2(int foo, String bar, num baz) = E; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:10:53: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, [dynamic])'. +// factory E.redirTooMany3(int foo, [dynamic bar]) = E; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:11:61: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, {Object bar})'. +// - 'Object' is from 'dart:core'. +// factory E.redirTooMany4(int foo, {required Object bar}) = E; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:13:11: Error: Cyclic definition of factory 'E.redirCyclic1'. +// factory E.redirCyclic1(int foo) = E.redirCyclic2; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:14:11: Error: Cyclic definition of factory 'E.redirCyclic2'. +// factory E.redirCyclic2(int foo) = E.redirCyclic1; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:16:11: Error: Cyclic definition of factory 'E.redirCyclicSelf'. +// factory E.redirCyclicSelf(int foo) = E.redirCyclicSelf; // Error. +// ^ +// +// pkg/front_end/testcases/extension_types/issue53209.dart:20:34: Error: The constructor function type 'GE Function(dynamic)' isn't a subtype of 'GE Function()'. +// factory GE.redirNotEnough1() = GE; // Error. +// ^ +// +import self as self; +import "dart:core" as core; + +extension type E(core::int foo) { + abstract inline-class-member representation-field get foo() → core::int; + constructor • = self::E|constructor#; + constructor tearoff • = self::E|constructor#_#new#tearOff; + static redirecting-factory redirNotEnough = self::E|constructor#redirNotEnough; + static redirecting-factory tearoff redirNotEnough = self::E|constructor#_#redirNotEnough#tearOff; + static redirecting-factory redirTooMany1 = self::E|constructor#redirTooMany1; + static redirecting-factory tearoff redirTooMany1 = self::E|constructor#_#redirTooMany1#tearOff; + static redirecting-factory redirTooMany2 = self::E|constructor#redirTooMany2; + static redirecting-factory tearoff redirTooMany2 = self::E|constructor#_#redirTooMany2#tearOff; + static redirecting-factory redirTooMany3 = self::E|constructor#redirTooMany3; + static redirecting-factory tearoff redirTooMany3 = self::E|constructor#_#redirTooMany3#tearOff; + static redirecting-factory redirTooMany4 = self::E|constructor#redirTooMany4; + static redirecting-factory tearoff redirTooMany4 = self::E|constructor#_#redirTooMany4#tearOff; + static redirecting-factory redirCyclic1 = self::E|constructor#redirCyclic1; + static redirecting-factory tearoff redirCyclic1 = self::E|constructor#_#redirCyclic1#tearOff; + static redirecting-factory redirCyclic2 = self::E|constructor#redirCyclic2; + static redirecting-factory tearoff redirCyclic2 = self::E|constructor#_#redirCyclic2#tearOff; + static redirecting-factory redirCyclicSelf = self::E|constructor#redirCyclicSelf; + static redirecting-factory tearoff redirCyclicSelf = self::E|constructor#_#redirCyclicSelf#tearOff; +} +extension type GE(X% foo) { + abstract inline-class-member representation-field get foo() → X%; + constructor • = self::GE|constructor#; + constructor tearoff • = self::GE|constructor#_#new#tearOff; + static redirecting-factory redirNotEnough1 = self::GE|constructor#redirNotEnough1; + static redirecting-factory tearoff redirNotEnough1 = self::GE|constructor#_#redirNotEnough1#tearOff; + static redirecting-factory redirNotEnough2 = self::GE|constructor#redirNotEnough2; + static redirecting-factory tearoff redirNotEnough2 = self::GE|constructor#_#redirNotEnough2#tearOff; +} +static inline-class-member method E|constructor#(core::int foo) → self::E /* = core::int */ { + lowered final self::E /* = core::int */ #this = foo; + return #this; +} +static inline-class-member method E|constructor#_#new#tearOff(core::int foo) → self::E /* = core::int */ + return self::E|constructor#(foo); +static inline-class-member method E|constructor#redirNotEnough() → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:6:32: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function()'. + factory E.redirNotEnough() = E; // Error. + ^"; +static inline-class-member method E|constructor#_#redirNotEnough#tearOff() → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:6:32: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function()'. + factory E.redirNotEnough() = E; // Error. + ^"; +static inline-class-member method E|constructor#redirTooMany1(core::int foo, core::String bar = #C1) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:8:50: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String)'. + factory E.redirTooMany1(int foo, String bar) = E; // Error. + ^"; +static inline-class-member method E|constructor#_#redirTooMany1#tearOff(core::int foo, core::String bar = #C1) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:8:50: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String)'. + factory E.redirTooMany1(int foo, String bar) = E; // Error. + ^"; +static inline-class-member method E|constructor#redirTooMany2(core::int foo, core::String bar = #C1, core::num baz = #C1) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:9:59: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String, num)'. + factory E.redirTooMany2(int foo, String bar, num baz) = E; // Error. + ^"; +static inline-class-member method E|constructor#_#redirTooMany2#tearOff(core::int foo, core::String bar = #C1, core::num baz = #C1) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:9:59: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, String, num)'. + factory E.redirTooMany2(int foo, String bar, num baz) = E; // Error. + ^"; +static inline-class-member method E|constructor#redirTooMany3(core::int foo, [dynamic bar = #C1]) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:10:53: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, [dynamic])'. + factory E.redirTooMany3(int foo, [dynamic bar]) = E; // Error. + ^"; +static inline-class-member method E|constructor#_#redirTooMany3#tearOff(core::int foo, [dynamic bar = #C1]) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:10:53: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, [dynamic])'. + factory E.redirTooMany3(int foo, [dynamic bar]) = E; // Error. + ^"; +static inline-class-member method E|constructor#redirTooMany4(core::int foo, {required core::Object bar = #C1}) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:11:61: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, {Object bar})'. + - 'Object' is from 'dart:core'. + factory E.redirTooMany4(int foo, {required Object bar}) = E; // Error. + ^"; +static inline-class-member method E|constructor#_#redirTooMany4#tearOff(core::int foo, {required core::Object bar = #C1}) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:11:61: Error: The constructor function type 'E Function(int)' isn't a subtype of 'E Function(int, {Object bar})'. + - 'Object' is from 'dart:core'. + factory E.redirTooMany4(int foo, {required Object bar}) = E; // Error. + ^"; +static inline-class-member method E|constructor#redirCyclic1(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:13:11: Error: Cyclic definition of factory 'E.redirCyclic1'. + factory E.redirCyclic1(int foo) = E.redirCyclic2; // Error. + ^"; +static inline-class-member method E|constructor#_#redirCyclic1#tearOff(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:13:11: Error: Cyclic definition of factory 'E.redirCyclic1'. + factory E.redirCyclic1(int foo) = E.redirCyclic2; // Error. + ^"; +static inline-class-member method E|constructor#redirCyclic2(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:14:11: Error: Cyclic definition of factory 'E.redirCyclic2'. + factory E.redirCyclic2(int foo) = E.redirCyclic1; // Error. + ^"; +static inline-class-member method E|constructor#_#redirCyclic2#tearOff(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:14:11: Error: Cyclic definition of factory 'E.redirCyclic2'. + factory E.redirCyclic2(int foo) = E.redirCyclic1; // Error. + ^"; +static inline-class-member method E|constructor#redirCyclicSelf(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:16:11: Error: Cyclic definition of factory 'E.redirCyclicSelf'. + factory E.redirCyclicSelf(int foo) = E.redirCyclicSelf; // Error. + ^"; +static inline-class-member method E|constructor#_#redirCyclicSelf#tearOff(core::int foo) → self::E /* = core::int */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:16:11: Error: Cyclic definition of factory 'E.redirCyclicSelf'. + factory E.redirCyclicSelf(int foo) = E.redirCyclicSelf; // Error. + ^"; +static inline-class-member method GE|constructor#(self::GE|constructor#::X% foo) → self::GE /* = self::GE|constructor#::X% */ { + lowered final self::GE /* = self::GE|constructor#::X% */ #this = foo; + return #this; +} +static inline-class-member method GE|constructor#_#new#tearOff(self::GE|constructor#_#new#tearOff::X% foo) → self::GE% /* = self::GE|constructor#_#new#tearOff::X% */ + return self::GE|constructor#(foo); +static inline-class-member method GE|constructor#redirNotEnough1() → self::GE /* = self::GE|constructor#redirNotEnough1::X% */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:20:34: Error: The constructor function type 'GE Function(dynamic)' isn't a subtype of 'GE Function()'. + factory GE.redirNotEnough1() = GE; // Error. + ^"; +static inline-class-member method GE|constructor#_#redirNotEnough1#tearOff() → self::GE% /* = self::GE|constructor#_#redirNotEnough1#tearOff::X% */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:20:34: Error: The constructor function type 'GE Function(dynamic)' isn't a subtype of 'GE Function()'. + factory GE.redirNotEnough1() = GE; // Error. + ^"; +static inline-class-member method GE|constructor#redirNotEnough2() → self::GE /* = self::GE|constructor#redirNotEnough2::X% */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:20:34: Error: The constructor function type 'GE Function(dynamic)' isn't a subtype of 'GE Function()'. + factory GE.redirNotEnough1() = GE; // Error. + ^"; +static inline-class-member method GE|constructor#_#redirNotEnough2#tearOff() → self::GE% /* = self::GE|constructor#_#redirNotEnough2#tearOff::X% */ + return invalid-expression "pkg/front_end/testcases/extension_types/issue53209.dart:20:34: Error: The constructor function type 'GE Function(dynamic)' isn't a subtype of 'GE Function()'. + factory GE.redirNotEnough1() = GE; // Error. + ^"; + +constants { + #C1 = null +}