diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart index 80ca7259edca..07a376495c8d 100644 --- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart +++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart @@ -1854,6 +1854,7 @@ class BodyBuilder extends StackListenerImpl List? positionalSuperParametersAsArguments; List? namedSuperParametersAsArguments; + Set? namedSuperParameterNames; if (formals != null) { for (FormalParameterBuilder formal in formals) { if (formal.isSuperInitializingFormal) { @@ -1865,6 +1866,7 @@ class BodyBuilder extends StackListenerImpl forNullGuardedAccess: false) ..fileOffset = formal.charOffset) ..fileOffset = formal.charOffset); + (namedSuperParameterNames ??= {}).add(formal.name); } else { (positionalSuperParametersAsArguments ??= []).add( new VariableGetImpl(formal.variable!, @@ -1886,7 +1888,7 @@ class BodyBuilder extends StackListenerImpl superInitializer.fileOffset, noLength)) ..parent = constructor; } else if (libraryBuilder.enableSuperParametersInLibrary) { - Arguments arguments = superInitializer.arguments; + ArgumentsImpl arguments = superInitializer.arguments as ArgumentsImpl; if (positionalSuperParametersAsArguments != null) { if (arguments.positional.isNotEmpty) { @@ -1904,12 +1906,14 @@ class BodyBuilder extends StackListenerImpl } else { arguments.positional.addAll(positionalSuperParametersAsArguments); setParents(positionalSuperParametersAsArguments, arguments); + arguments.positionalAreSuperParameters = true; } } if (namedSuperParametersAsArguments != null) { // TODO(cstefantsova): Report name conflicts. arguments.named.addAll(namedSuperParametersAsArguments); setParents(namedSuperParametersAsArguments, arguments); + arguments.namedSuperParameterNames = namedSuperParameterNames; } } } else if (initializers.last is RedirectingInitializer) { @@ -1958,7 +1962,7 @@ class BodyBuilder extends StackListenerImpl /// >unless the enclosing class is class Object. Constructor? superTarget = lookupConstructor(emptyName, isSuper: true); Initializer initializer; - Arguments arguments; + ArgumentsImpl arguments; List? positionalArguments; List? namedArguments; if (libraryBuilder.enableSuperParametersInLibrary) { @@ -1976,6 +1980,7 @@ class BodyBuilder extends StackListenerImpl forNullGuardedAccess: false) ]); } + if (positionalArguments != null || namedArguments != null) { arguments = forest.createArguments( noLocation, positionalArguments ?? [], @@ -1983,6 +1988,11 @@ class BodyBuilder extends StackListenerImpl } else { arguments = forest.createArgumentsEmpty(noLocation); } + + arguments.positionalAreSuperParameters = + positionalSuperParametersAsArguments != null; + arguments.namedSuperParameterNames = namedSuperParameterNames; + if (superTarget == null || checkArgumentsForFunction(superTarget.function, arguments, builder.charOffset, const []) != diff --git a/pkg/front_end/lib/src/fasta/kernel/internal_ast.dart b/pkg/front_end/lib/src/fasta/kernel/internal_ast.dart index 354dddc15970..3009ba151edf 100644 --- a/pkg/front_end/lib/src/fasta/kernel/internal_ast.dart +++ b/pkg/front_end/lib/src/fasta/kernel/internal_ast.dart @@ -493,6 +493,17 @@ class ArgumentsImpl extends Arguments { List? argumentsOriginalOrder; + /// True if the arguments are passed to the super-constructor in a + /// super-initializer, and the positional parameters are super-initializer + /// parameters. It is true that either all of the positional parameters are + /// super-initializer parameters or none of them, so a simple boolean + /// accurately reflects the state. + bool positionalAreSuperParameters = false; + + /// Names of the named positional parameters. If none of the parameters are + /// super-positional, the field is null. + Set? namedSuperParameterNames; + ArgumentsImpl.internal( {required List positional, required List? types, 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 1f1f6b295335..8dbfdacd3295 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 @@ -494,6 +494,7 @@ class TypeInferrerImpl implements TypeInferrer { DartType? declaredContextType, DartType? runtimeCheckedType, bool isVoidAllowed: false, + bool coerceExpression: true, Template? errorTemplate, Template? nullabilityErrorTemplate, @@ -509,6 +510,7 @@ class TypeInferrerImpl implements TypeInferrer { declaredContextType: declaredContextType, runtimeCheckedType: runtimeCheckedType, isVoidAllowed: isVoidAllowed, + coerceExpression: coerceExpression, errorTemplate: errorTemplate, nullabilityErrorTemplate: nullabilityErrorTemplate, nullabilityNullErrorTemplate: nullabilityNullErrorTemplate, @@ -527,6 +529,7 @@ class TypeInferrerImpl implements TypeInferrer { DartType? declaredContextType, DartType? runtimeCheckedType, bool isVoidAllowed: false, + bool coerceExpression: true, Template? errorTemplate, Template? nullabilityErrorTemplate, @@ -578,7 +581,8 @@ class TypeInferrerImpl implements TypeInferrer { contextType, inferenceResult.inferredType, isNonNullableByDefault: isNonNullableByDefault, isVoidAllowed: isVoidAllowed, - isExpressionTypePrecise: preciseTypeErrorTemplate != null); + isExpressionTypePrecise: preciseTypeErrorTemplate != null, + coerceExpression: coerceExpression); if (assignabilityResult.needsTearOff) { TypedTearoff typedTearoff = _tearOffCall(inferenceResult.expression, @@ -782,7 +786,8 @@ class TypeInferrerImpl implements TypeInferrer { DartType contextType, DartType expressionType, {required bool isNonNullableByDefault, required bool isVoidAllowed, - required bool isExpressionTypePrecise}) { + required bool isExpressionTypePrecise, + required bool coerceExpression}) { // ignore: unnecessary_null_comparison assert(isNonNullableByDefault != null); // ignore: unnecessary_null_comparison @@ -794,7 +799,7 @@ class TypeInferrerImpl implements TypeInferrer { // should tear off `.call`. // TODO(paulberry): use resolveTypeParameter. See findInterfaceMember. bool needsTearoff = false; - if (expressionType is InterfaceType) { + if (coerceExpression && expressionType is InterfaceType) { Class classNode = expressionType.classNode; Member? callMember = classHierarchy.getInterfaceMember(classNode, callName); @@ -813,7 +818,7 @@ class TypeInferrerImpl implements TypeInferrer { } } ImplicitInstantiation? implicitInstantiation; - if (libraryBuilder.enableConstructorTearOffsInLibrary) { + if (coerceExpression && libraryBuilder.enableConstructorTearOffsInLibrary) { implicitInstantiation = computeImplicitInstantiation(expressionType, contextType); if (implicitInstantiation != null) { @@ -867,8 +872,15 @@ class TypeInferrerImpl implements TypeInferrer { return const AssignabilityResult(AssignabilityKind.unassignablePrecise, needsTearOff: false); } - // Insert an implicit downcast. - return new AssignabilityResult(AssignabilityKind.assignableCast, + + if (coerceExpression) { + // Insert an implicit downcast. + return new AssignabilityResult(AssignabilityKind.assignableCast, + needsTearOff: needsTearoff, + implicitInstantiation: implicitInstantiation); + } + + return new AssignabilityResult(AssignabilityKind.unassignable, needsTearOff: needsTearoff, implicitInstantiation: implicitInstantiation); } @@ -2618,17 +2630,23 @@ class TypeInferrerImpl implements TypeInferrer { DartType actualType = actualTypes![i]; Expression expression; NamedExpression? namedExpression; + bool coerceExpression; if (i < numPositionalArgs) { expression = arguments.positional[positionalShift + i]; positionalArgumentTypes.add(actualType); + coerceExpression = !arguments.positionalAreSuperParameters; } else { namedExpression = arguments.named[i - numPositionalArgs]; expression = namedExpression.value; namedArgumentTypes .add(new NamedType(namedExpression.name, actualType)); + coerceExpression = !(arguments.namedSuperParameterNames + ?.contains(namedExpression.name) ?? + false); } expression = ensureAssignable(expectedType, actualType, expression, isVoidAllowed: expectedType is VoidType, + coerceExpression: coerceExpression, // TODO(johnniwinther): Specialize message for operator // invocations. errorTemplate: templateArgumentTypeNotAssignable, diff --git a/pkg/front_end/test/spell_checking_list_common.txt b/pkg/front_end/test/spell_checking_list_common.txt index 1d062f6973f5..c09bea15364f 100644 --- a/pkg/front_end/test/spell_checking_list_common.txt +++ b/pkg/front_end/test/spell_checking_list_common.txt @@ -47,6 +47,7 @@ account accounted accumulate accurate +accurately achieve act acting @@ -489,6 +490,7 @@ closure closures clue code +coerce coincides coinductively collapses diff --git a/pkg/front_end/testcases/super_parameters/no_coercions.dart b/pkg/front_end/testcases/super_parameters/no_coercions.dart new file mode 100644 index 000000000000..942256be26e1 --- /dev/null +++ b/pkg/front_end/testcases/super_parameters/no_coercions.dart @@ -0,0 +1,82 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +class A1 { + A1(int x); +} + +class B1 extends A1 { + B1.one(dynamic super.x); // Error. + B1.two(dynamic super.x) : super(); // Error. +} + +class A2 { + A2({required String x}); +} + +class B2 extends A2 { + B2.one({required dynamic super.x}); // Error. + B2.two({required dynamic super.x}) : super(); // Error. +} + +class A3 { + A3(num Function(double) f); +} + +class B3 extends A3 { + B3.one(X Function(double) super.f); // Error. + B3.two(X Function(double) super.f) : super(); // Error. +} + +class A4 { + A4({required num Function(double) f}); +} + +class B4 extends A4 { + B4.one({required X Function(double) super.f}); // Error. + B4.two({required X Function(double) super.f}) : super(); // Error. +} + +abstract class C5 { + String call(int x, num y); +} + +class A5 { + A5(String Function(int, num) f); +} + +class B5 extends A5 { + B5.one(C5 super.f); // Error. + B5.two(C5 super.f) : super(); // Error. +} + +class A6 { + A6({required String Function(int, num) f}); +} + +class B6 extends A6 { + B6.one({required C5 super.f}); // Error. + B6.two({required C5 super.f}) : super(); // Error. +} + +class A7 { + A7({required int x1, + required int x2, + required bool Function(Object) f1, + required bool Function(Object) f2, + required void Function(dynamic) g1, + required void Function(dynamic) g2}); +} + +class B7 extends A7 { + B7({required dynamic super.x1, // Error. + required dynamic x2, + required X Function(Object) super.f1, // Error. + required X Function(Object) f2, + required void Function(X) super.g1, // Error. + required void Function(X) g2}) : + super(x2: x2, f2: f2, g2: g2); // Ok. +} + +main() {} diff --git a/pkg/front_end/testcases/super_parameters/no_coercions.dart.strong.expect b/pkg/front_end/testcases/super_parameters/no_coercions.dart.strong.expect new file mode 100644 index 000000000000..1d154d826fab --- /dev/null +++ b/pkg/front_end/testcases/super_parameters/no_coercions.dart.strong.expect @@ -0,0 +1,206 @@ +library /*isNonNullableByDefault*/; +// +// Problems in library: +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:10:24: Error: The argument type 'dynamic' can't be assigned to the parameter type 'int'. +// B1.one(dynamic super.x); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:11:24: Error: The argument type 'dynamic' can't be assigned to the parameter type 'int'. +// B1.two(dynamic super.x) : super(); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:19:34: Error: The argument type 'dynamic' can't be assigned to the parameter type 'String'. +// B2.one({required dynamic super.x}); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:20:34: Error: The argument type 'dynamic' can't be assigned to the parameter type 'String'. +// B2.two({required dynamic super.x}) : super(); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:28:38: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. +// B3.one(X Function(double) super.f); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:29:38: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. +// B3.two(X Function(double) super.f) : super(); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:37:48: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. +// B4.one({required X Function(double) super.f}); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:38:48: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. +// B4.two({required X Function(double) super.f}) : super(); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:50:19: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. +// - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. +// B5.one(C5 super.f); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:51:19: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. +// - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. +// B5.two(C5 super.f) : super(); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:59:29: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. +// - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. +// B6.one({required C5 super.f}); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:60:29: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. +// - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. +// B6.two({required C5 super.f}) : super(); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:73:30: Error: The argument type 'dynamic' can't be assigned to the parameter type 'int'. +// B7({required dynamic super.x1, // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:75:44: Error: The argument type 'X Function(Object)' can't be assigned to the parameter type 'bool Function(Object)'. +// - 'Object' is from 'dart:core'. +// required X Function(Object) super.f1, // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:77:42: Error: The argument type 'void Function(X)' can't be assigned to the parameter type 'void Function(dynamic)'. +// required void Function(X) super.g1, // Error. +// ^ +// +import self as self; +import "dart:core" as core; + +class A1 extends core::Object { + constructor •(core::int x) → self::A1 + : super core::Object::•() + ; +} +class B1 extends self::A1 { + constructor one(dynamic x) → self::B1 + : super self::A1::•(invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:10:24: Error: The argument type 'dynamic' can't be assigned to the parameter type 'int'. + B1.one(dynamic super.x); // Error. + ^" in x as{TypeError,ForNonNullableByDefault} core::int) + ; + constructor two(dynamic x) → self::B1 + : super self::A1::•(invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:11:24: Error: The argument type 'dynamic' can't be assigned to the parameter type 'int'. + B1.two(dynamic super.x) : super(); // Error. + ^" in x as{TypeError,ForNonNullableByDefault} core::int) + ; +} +class A2 extends core::Object { + constructor •({required core::String x = #C1}) → self::A2 + : super core::Object::•() + ; +} +class B2 extends self::A2 { + constructor one({required dynamic x = #C1}) → self::B2 + : super self::A2::•(x: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:19:34: Error: The argument type 'dynamic' can't be assigned to the parameter type 'String'. + B2.one({required dynamic super.x}); // Error. + ^" in x as{TypeError,ForNonNullableByDefault} core::String) + ; + constructor two({required dynamic x = #C1}) → self::B2 + : super self::A2::•(x: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:20:34: Error: The argument type 'dynamic' can't be assigned to the parameter type 'String'. + B2.two({required dynamic super.x}) : super(); // Error. + ^" in x as{TypeError,ForNonNullableByDefault} core::String) + ; +} +class A3 extends core::Object { + constructor •((core::double) → core::num f) → self::A3 + : super core::Object::•() + ; +} +class B3 extends self::A3 { + constructor one((core::double) → X% f) → self::B3 + : super self::A3::•(invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:28:38: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. + B3.one(X Function(double) super.f); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::double) → core::num) + ; + constructor two((core::double) → X% f) → self::B3 + : super self::A3::•(invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:29:38: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. + B3.two(X Function(double) super.f) : super(); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::double) → core::num) + ; +} +class A4 extends core::Object { + constructor •({required (core::double) → core::num f = #C1}) → self::A4 + : super core::Object::•() + ; +} +class B4 extends self::A4 { + constructor one({required (core::double) → X% f = #C1}) → self::B4 + : super self::A4::•(f: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:37:48: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. + B4.one({required X Function(double) super.f}); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::double) → core::num) + ; + constructor two({required (core::double) → X% f = #C1}) → self::B4 + : super self::A4::•(f: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:38:48: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. + B4.two({required X Function(double) super.f}) : super(); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::double) → core::num) + ; +} +abstract class C5 extends core::Object { + synthetic constructor •() → self::C5 + : super core::Object::•() + ; + abstract method call(core::int x, core::num y) → core::String; +} +class A5 extends core::Object { + constructor •((core::int, core::num) → core::String f) → self::A5 + : super core::Object::•() + ; +} +class B5 extends self::A5 { + constructor one(self::C5 f) → self::B5 + : super self::A5::•(invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:50:19: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. + - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. + B5.one(C5 super.f); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::int, core::num) → core::String) + ; + constructor two(self::C5 f) → self::B5 + : super self::A5::•(invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:51:19: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. + - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. + B5.two(C5 super.f) : super(); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::int, core::num) → core::String) + ; +} +class A6 extends core::Object { + constructor •({required (core::int, core::num) → core::String f = #C1}) → self::A6 + : super core::Object::•() + ; +} +class B6 extends self::A6 { + constructor one({required self::C5 f = #C1}) → self::B6 + : super self::A6::•(f: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:59:29: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. + - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. + B6.one({required C5 super.f}); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::int, core::num) → core::String) + ; + constructor two({required self::C5 f = #C1}) → self::B6 + : super self::A6::•(f: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:60:29: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. + - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. + B6.two({required C5 super.f}) : super(); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::int, core::num) → core::String) + ; +} +class A7 extends core::Object { + constructor •({required core::int x1 = #C1, required core::int x2 = #C1, required (core::Object) → core::bool f1 = #C1, required (core::Object) → core::bool f2 = #C1, required (dynamic) → void g1 = #C1, required (dynamic) → void g2 = #C1}) → self::A7 + : super core::Object::•() + ; +} +class B7 extends self::A7 { + constructor •({required dynamic x1 = #C1, required dynamic x2 = #C1, required (core::Object) → X% f1 = #C1, required (core::Object) → X% f2 = #C1, required (X%) → void g1 = #C1, required (X%) → void g2 = #C1}) → self::B7 + : super self::A7::•(x2: x2 as{TypeError,ForDynamic,ForNonNullableByDefault} core::int, f2: f2, g2: g2, x1: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:73:30: Error: The argument type 'dynamic' can't be assigned to the parameter type 'int'. + B7({required dynamic super.x1, // Error. + ^" in x1 as{TypeError,ForNonNullableByDefault} core::int, f1: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:75:44: Error: The argument type 'X Function(Object)' can't be assigned to the parameter type 'bool Function(Object)'. + - 'Object' is from 'dart:core'. + required X Function(Object) super.f1, // Error. + ^" in f1 as{TypeError,ForNonNullableByDefault} (core::Object) → core::bool, g1: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:77:42: Error: The argument type 'void Function(X)' can't be assigned to the parameter type 'void Function(dynamic)'. + required void Function(X) super.g1, // Error. + ^" in g1 as{TypeError,ForNonNullableByDefault} (dynamic) → void) + ; +} +static method main() → dynamic {} + +constants { + #C1 = null +} diff --git a/pkg/front_end/testcases/super_parameters/no_coercions.dart.strong.transformed.expect b/pkg/front_end/testcases/super_parameters/no_coercions.dart.strong.transformed.expect new file mode 100644 index 000000000000..1d154d826fab --- /dev/null +++ b/pkg/front_end/testcases/super_parameters/no_coercions.dart.strong.transformed.expect @@ -0,0 +1,206 @@ +library /*isNonNullableByDefault*/; +// +// Problems in library: +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:10:24: Error: The argument type 'dynamic' can't be assigned to the parameter type 'int'. +// B1.one(dynamic super.x); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:11:24: Error: The argument type 'dynamic' can't be assigned to the parameter type 'int'. +// B1.two(dynamic super.x) : super(); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:19:34: Error: The argument type 'dynamic' can't be assigned to the parameter type 'String'. +// B2.one({required dynamic super.x}); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:20:34: Error: The argument type 'dynamic' can't be assigned to the parameter type 'String'. +// B2.two({required dynamic super.x}) : super(); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:28:38: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. +// B3.one(X Function(double) super.f); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:29:38: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. +// B3.two(X Function(double) super.f) : super(); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:37:48: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. +// B4.one({required X Function(double) super.f}); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:38:48: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. +// B4.two({required X Function(double) super.f}) : super(); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:50:19: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. +// - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. +// B5.one(C5 super.f); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:51:19: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. +// - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. +// B5.two(C5 super.f) : super(); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:59:29: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. +// - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. +// B6.one({required C5 super.f}); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:60:29: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. +// - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. +// B6.two({required C5 super.f}) : super(); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:73:30: Error: The argument type 'dynamic' can't be assigned to the parameter type 'int'. +// B7({required dynamic super.x1, // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:75:44: Error: The argument type 'X Function(Object)' can't be assigned to the parameter type 'bool Function(Object)'. +// - 'Object' is from 'dart:core'. +// required X Function(Object) super.f1, // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:77:42: Error: The argument type 'void Function(X)' can't be assigned to the parameter type 'void Function(dynamic)'. +// required void Function(X) super.g1, // Error. +// ^ +// +import self as self; +import "dart:core" as core; + +class A1 extends core::Object { + constructor •(core::int x) → self::A1 + : super core::Object::•() + ; +} +class B1 extends self::A1 { + constructor one(dynamic x) → self::B1 + : super self::A1::•(invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:10:24: Error: The argument type 'dynamic' can't be assigned to the parameter type 'int'. + B1.one(dynamic super.x); // Error. + ^" in x as{TypeError,ForNonNullableByDefault} core::int) + ; + constructor two(dynamic x) → self::B1 + : super self::A1::•(invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:11:24: Error: The argument type 'dynamic' can't be assigned to the parameter type 'int'. + B1.two(dynamic super.x) : super(); // Error. + ^" in x as{TypeError,ForNonNullableByDefault} core::int) + ; +} +class A2 extends core::Object { + constructor •({required core::String x = #C1}) → self::A2 + : super core::Object::•() + ; +} +class B2 extends self::A2 { + constructor one({required dynamic x = #C1}) → self::B2 + : super self::A2::•(x: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:19:34: Error: The argument type 'dynamic' can't be assigned to the parameter type 'String'. + B2.one({required dynamic super.x}); // Error. + ^" in x as{TypeError,ForNonNullableByDefault} core::String) + ; + constructor two({required dynamic x = #C1}) → self::B2 + : super self::A2::•(x: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:20:34: Error: The argument type 'dynamic' can't be assigned to the parameter type 'String'. + B2.two({required dynamic super.x}) : super(); // Error. + ^" in x as{TypeError,ForNonNullableByDefault} core::String) + ; +} +class A3 extends core::Object { + constructor •((core::double) → core::num f) → self::A3 + : super core::Object::•() + ; +} +class B3 extends self::A3 { + constructor one((core::double) → X% f) → self::B3 + : super self::A3::•(invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:28:38: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. + B3.one(X Function(double) super.f); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::double) → core::num) + ; + constructor two((core::double) → X% f) → self::B3 + : super self::A3::•(invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:29:38: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. + B3.two(X Function(double) super.f) : super(); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::double) → core::num) + ; +} +class A4 extends core::Object { + constructor •({required (core::double) → core::num f = #C1}) → self::A4 + : super core::Object::•() + ; +} +class B4 extends self::A4 { + constructor one({required (core::double) → X% f = #C1}) → self::B4 + : super self::A4::•(f: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:37:48: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. + B4.one({required X Function(double) super.f}); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::double) → core::num) + ; + constructor two({required (core::double) → X% f = #C1}) → self::B4 + : super self::A4::•(f: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:38:48: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. + B4.two({required X Function(double) super.f}) : super(); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::double) → core::num) + ; +} +abstract class C5 extends core::Object { + synthetic constructor •() → self::C5 + : super core::Object::•() + ; + abstract method call(core::int x, core::num y) → core::String; +} +class A5 extends core::Object { + constructor •((core::int, core::num) → core::String f) → self::A5 + : super core::Object::•() + ; +} +class B5 extends self::A5 { + constructor one(self::C5 f) → self::B5 + : super self::A5::•(invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:50:19: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. + - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. + B5.one(C5 super.f); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::int, core::num) → core::String) + ; + constructor two(self::C5 f) → self::B5 + : super self::A5::•(invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:51:19: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. + - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. + B5.two(C5 super.f) : super(); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::int, core::num) → core::String) + ; +} +class A6 extends core::Object { + constructor •({required (core::int, core::num) → core::String f = #C1}) → self::A6 + : super core::Object::•() + ; +} +class B6 extends self::A6 { + constructor one({required self::C5 f = #C1}) → self::B6 + : super self::A6::•(f: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:59:29: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. + - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. + B6.one({required C5 super.f}); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::int, core::num) → core::String) + ; + constructor two({required self::C5 f = #C1}) → self::B6 + : super self::A6::•(f: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:60:29: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. + - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. + B6.two({required C5 super.f}) : super(); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::int, core::num) → core::String) + ; +} +class A7 extends core::Object { + constructor •({required core::int x1 = #C1, required core::int x2 = #C1, required (core::Object) → core::bool f1 = #C1, required (core::Object) → core::bool f2 = #C1, required (dynamic) → void g1 = #C1, required (dynamic) → void g2 = #C1}) → self::A7 + : super core::Object::•() + ; +} +class B7 extends self::A7 { + constructor •({required dynamic x1 = #C1, required dynamic x2 = #C1, required (core::Object) → X% f1 = #C1, required (core::Object) → X% f2 = #C1, required (X%) → void g1 = #C1, required (X%) → void g2 = #C1}) → self::B7 + : super self::A7::•(x2: x2 as{TypeError,ForDynamic,ForNonNullableByDefault} core::int, f2: f2, g2: g2, x1: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:73:30: Error: The argument type 'dynamic' can't be assigned to the parameter type 'int'. + B7({required dynamic super.x1, // Error. + ^" in x1 as{TypeError,ForNonNullableByDefault} core::int, f1: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:75:44: Error: The argument type 'X Function(Object)' can't be assigned to the parameter type 'bool Function(Object)'. + - 'Object' is from 'dart:core'. + required X Function(Object) super.f1, // Error. + ^" in f1 as{TypeError,ForNonNullableByDefault} (core::Object) → core::bool, g1: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:77:42: Error: The argument type 'void Function(X)' can't be assigned to the parameter type 'void Function(dynamic)'. + required void Function(X) super.g1, // Error. + ^" in g1 as{TypeError,ForNonNullableByDefault} (dynamic) → void) + ; +} +static method main() → dynamic {} + +constants { + #C1 = null +} diff --git a/pkg/front_end/testcases/super_parameters/no_coercions.dart.textual_outline.expect b/pkg/front_end/testcases/super_parameters/no_coercions.dart.textual_outline.expect new file mode 100644 index 000000000000..80093ec695f5 --- /dev/null +++ b/pkg/front_end/testcases/super_parameters/no_coercions.dart.textual_outline.expect @@ -0,0 +1,80 @@ +class A1 { + A1(int x); +} + +class B1 extends A1 { + B1.one(dynamic super.x); + B1.two(dynamic super.x) : super(); +} + +class A2 { + A2({required String x}); +} + +class B2 extends A2 { + B2.one({required dynamic super.x}); + B2.two({required dynamic super.x}) : super(); +} + +class A3 { + A3(num Function(double) f); +} + +class B3 extends A3 { + B3.one(X Function(double) super.f); + B3.two(X Function(double) super.f) : super(); +} + +class A4 { + A4({required num Function(double) f}); +} + +class B4 extends A4 { + B4.one({required X Function(double) super.f}); + B4.two({required X Function(double) super.f}) : super(); +} + +abstract class C5 { + String call(int x, num y); +} + +class A5 { + A5(String Function(int, num) f); +} + +class B5 extends A5 { + B5.one(C5 super.f); + B5.two(C5 super.f) : super(); +} + +class A6 { + A6({required String Function(int, num) f}); +} + +class B6 extends A6 { + B6.one({required C5 super.f}); + B6.two({required C5 super.f}) : super(); +} + +class A7 { + A7( + {required int x1, + required int x2, + required bool Function(Object) f1, + required bool Function(Object) f2, + required void Function(dynamic) g1, + required void Function(dynamic) g2}); +} + +class B7 extends A7 { + B7( + {required dynamic super.x1, + required dynamic x2, + required X Function(Object) super.f1, + required X Function(Object) f2, + required void Function(X) super.g1, + required void Function(X) g2}) + : super(x2: x2, f2: f2, g2: g2); +} + +main() {} diff --git a/pkg/front_end/testcases/super_parameters/no_coercions.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/super_parameters/no_coercions.dart.textual_outline_modelled.expect new file mode 100644 index 000000000000..d6b43c6e0d4f --- /dev/null +++ b/pkg/front_end/testcases/super_parameters/no_coercions.dart.textual_outline_modelled.expect @@ -0,0 +1,80 @@ +abstract class C5 { + String call(int x, num y); +} + +class A1 { + A1(int x); +} + +class A2 { + A2({required String x}); +} + +class A3 { + A3(num Function(double) f); +} + +class A4 { + A4({required num Function(double) f}); +} + +class A5 { + A5(String Function(int, num) f); +} + +class A6 { + A6({required String Function(int, num) f}); +} + +class A7 { + A7( + {required int x1, + required int x2, + required bool Function(Object) f1, + required bool Function(Object) f2, + required void Function(dynamic) g1, + required void Function(dynamic) g2}); +} + +class B1 extends A1 { + B1.one(dynamic super.x); + B1.two(dynamic super.x) : super(); +} + +class B2 extends A2 { + B2.one({required dynamic super.x}); + B2.two({required dynamic super.x}) : super(); +} + +class B3 extends A3 { + B3.one(X Function(double) super.f); + B3.two(X Function(double) super.f) : super(); +} + +class B4 extends A4 { + B4.one({required X Function(double) super.f}); + B4.two({required X Function(double) super.f}) : super(); +} + +class B5 extends A5 { + B5.one(C5 super.f); + B5.two(C5 super.f) : super(); +} + +class B6 extends A6 { + B6.one({required C5 super.f}); + B6.two({required C5 super.f}) : super(); +} + +class B7 extends A7 { + B7( + {required dynamic super.x1, + required dynamic x2, + required X Function(Object) super.f1, + required X Function(Object) f2, + required void Function(X) super.g1, + required void Function(X) g2}) + : super(x2: x2, f2: f2, g2: g2); +} + +main() {} diff --git a/pkg/front_end/testcases/super_parameters/no_coercions.dart.weak.expect b/pkg/front_end/testcases/super_parameters/no_coercions.dart.weak.expect new file mode 100644 index 000000000000..1d154d826fab --- /dev/null +++ b/pkg/front_end/testcases/super_parameters/no_coercions.dart.weak.expect @@ -0,0 +1,206 @@ +library /*isNonNullableByDefault*/; +// +// Problems in library: +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:10:24: Error: The argument type 'dynamic' can't be assigned to the parameter type 'int'. +// B1.one(dynamic super.x); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:11:24: Error: The argument type 'dynamic' can't be assigned to the parameter type 'int'. +// B1.two(dynamic super.x) : super(); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:19:34: Error: The argument type 'dynamic' can't be assigned to the parameter type 'String'. +// B2.one({required dynamic super.x}); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:20:34: Error: The argument type 'dynamic' can't be assigned to the parameter type 'String'. +// B2.two({required dynamic super.x}) : super(); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:28:38: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. +// B3.one(X Function(double) super.f); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:29:38: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. +// B3.two(X Function(double) super.f) : super(); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:37:48: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. +// B4.one({required X Function(double) super.f}); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:38:48: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. +// B4.two({required X Function(double) super.f}) : super(); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:50:19: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. +// - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. +// B5.one(C5 super.f); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:51:19: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. +// - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. +// B5.two(C5 super.f) : super(); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:59:29: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. +// - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. +// B6.one({required C5 super.f}); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:60:29: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. +// - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. +// B6.two({required C5 super.f}) : super(); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:73:30: Error: The argument type 'dynamic' can't be assigned to the parameter type 'int'. +// B7({required dynamic super.x1, // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:75:44: Error: The argument type 'X Function(Object)' can't be assigned to the parameter type 'bool Function(Object)'. +// - 'Object' is from 'dart:core'. +// required X Function(Object) super.f1, // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:77:42: Error: The argument type 'void Function(X)' can't be assigned to the parameter type 'void Function(dynamic)'. +// required void Function(X) super.g1, // Error. +// ^ +// +import self as self; +import "dart:core" as core; + +class A1 extends core::Object { + constructor •(core::int x) → self::A1 + : super core::Object::•() + ; +} +class B1 extends self::A1 { + constructor one(dynamic x) → self::B1 + : super self::A1::•(invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:10:24: Error: The argument type 'dynamic' can't be assigned to the parameter type 'int'. + B1.one(dynamic super.x); // Error. + ^" in x as{TypeError,ForNonNullableByDefault} core::int) + ; + constructor two(dynamic x) → self::B1 + : super self::A1::•(invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:11:24: Error: The argument type 'dynamic' can't be assigned to the parameter type 'int'. + B1.two(dynamic super.x) : super(); // Error. + ^" in x as{TypeError,ForNonNullableByDefault} core::int) + ; +} +class A2 extends core::Object { + constructor •({required core::String x = #C1}) → self::A2 + : super core::Object::•() + ; +} +class B2 extends self::A2 { + constructor one({required dynamic x = #C1}) → self::B2 + : super self::A2::•(x: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:19:34: Error: The argument type 'dynamic' can't be assigned to the parameter type 'String'. + B2.one({required dynamic super.x}); // Error. + ^" in x as{TypeError,ForNonNullableByDefault} core::String) + ; + constructor two({required dynamic x = #C1}) → self::B2 + : super self::A2::•(x: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:20:34: Error: The argument type 'dynamic' can't be assigned to the parameter type 'String'. + B2.two({required dynamic super.x}) : super(); // Error. + ^" in x as{TypeError,ForNonNullableByDefault} core::String) + ; +} +class A3 extends core::Object { + constructor •((core::double) → core::num f) → self::A3 + : super core::Object::•() + ; +} +class B3 extends self::A3 { + constructor one((core::double) → X% f) → self::B3 + : super self::A3::•(invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:28:38: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. + B3.one(X Function(double) super.f); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::double) → core::num) + ; + constructor two((core::double) → X% f) → self::B3 + : super self::A3::•(invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:29:38: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. + B3.two(X Function(double) super.f) : super(); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::double) → core::num) + ; +} +class A4 extends core::Object { + constructor •({required (core::double) → core::num f = #C1}) → self::A4 + : super core::Object::•() + ; +} +class B4 extends self::A4 { + constructor one({required (core::double) → X% f = #C1}) → self::B4 + : super self::A4::•(f: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:37:48: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. + B4.one({required X Function(double) super.f}); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::double) → core::num) + ; + constructor two({required (core::double) → X% f = #C1}) → self::B4 + : super self::A4::•(f: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:38:48: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. + B4.two({required X Function(double) super.f}) : super(); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::double) → core::num) + ; +} +abstract class C5 extends core::Object { + synthetic constructor •() → self::C5 + : super core::Object::•() + ; + abstract method call(core::int x, core::num y) → core::String; +} +class A5 extends core::Object { + constructor •((core::int, core::num) → core::String f) → self::A5 + : super core::Object::•() + ; +} +class B5 extends self::A5 { + constructor one(self::C5 f) → self::B5 + : super self::A5::•(invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:50:19: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. + - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. + B5.one(C5 super.f); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::int, core::num) → core::String) + ; + constructor two(self::C5 f) → self::B5 + : super self::A5::•(invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:51:19: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. + - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. + B5.two(C5 super.f) : super(); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::int, core::num) → core::String) + ; +} +class A6 extends core::Object { + constructor •({required (core::int, core::num) → core::String f = #C1}) → self::A6 + : super core::Object::•() + ; +} +class B6 extends self::A6 { + constructor one({required self::C5 f = #C1}) → self::B6 + : super self::A6::•(f: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:59:29: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. + - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. + B6.one({required C5 super.f}); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::int, core::num) → core::String) + ; + constructor two({required self::C5 f = #C1}) → self::B6 + : super self::A6::•(f: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:60:29: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. + - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. + B6.two({required C5 super.f}) : super(); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::int, core::num) → core::String) + ; +} +class A7 extends core::Object { + constructor •({required core::int x1 = #C1, required core::int x2 = #C1, required (core::Object) → core::bool f1 = #C1, required (core::Object) → core::bool f2 = #C1, required (dynamic) → void g1 = #C1, required (dynamic) → void g2 = #C1}) → self::A7 + : super core::Object::•() + ; +} +class B7 extends self::A7 { + constructor •({required dynamic x1 = #C1, required dynamic x2 = #C1, required (core::Object) → X% f1 = #C1, required (core::Object) → X% f2 = #C1, required (X%) → void g1 = #C1, required (X%) → void g2 = #C1}) → self::B7 + : super self::A7::•(x2: x2 as{TypeError,ForDynamic,ForNonNullableByDefault} core::int, f2: f2, g2: g2, x1: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:73:30: Error: The argument type 'dynamic' can't be assigned to the parameter type 'int'. + B7({required dynamic super.x1, // Error. + ^" in x1 as{TypeError,ForNonNullableByDefault} core::int, f1: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:75:44: Error: The argument type 'X Function(Object)' can't be assigned to the parameter type 'bool Function(Object)'. + - 'Object' is from 'dart:core'. + required X Function(Object) super.f1, // Error. + ^" in f1 as{TypeError,ForNonNullableByDefault} (core::Object) → core::bool, g1: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:77:42: Error: The argument type 'void Function(X)' can't be assigned to the parameter type 'void Function(dynamic)'. + required void Function(X) super.g1, // Error. + ^" in g1 as{TypeError,ForNonNullableByDefault} (dynamic) → void) + ; +} +static method main() → dynamic {} + +constants { + #C1 = null +} diff --git a/pkg/front_end/testcases/super_parameters/no_coercions.dart.weak.modular.expect b/pkg/front_end/testcases/super_parameters/no_coercions.dart.weak.modular.expect new file mode 100644 index 000000000000..1d154d826fab --- /dev/null +++ b/pkg/front_end/testcases/super_parameters/no_coercions.dart.weak.modular.expect @@ -0,0 +1,206 @@ +library /*isNonNullableByDefault*/; +// +// Problems in library: +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:10:24: Error: The argument type 'dynamic' can't be assigned to the parameter type 'int'. +// B1.one(dynamic super.x); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:11:24: Error: The argument type 'dynamic' can't be assigned to the parameter type 'int'. +// B1.two(dynamic super.x) : super(); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:19:34: Error: The argument type 'dynamic' can't be assigned to the parameter type 'String'. +// B2.one({required dynamic super.x}); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:20:34: Error: The argument type 'dynamic' can't be assigned to the parameter type 'String'. +// B2.two({required dynamic super.x}) : super(); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:28:38: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. +// B3.one(X Function(double) super.f); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:29:38: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. +// B3.two(X Function(double) super.f) : super(); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:37:48: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. +// B4.one({required X Function(double) super.f}); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:38:48: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. +// B4.two({required X Function(double) super.f}) : super(); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:50:19: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. +// - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. +// B5.one(C5 super.f); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:51:19: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. +// - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. +// B5.two(C5 super.f) : super(); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:59:29: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. +// - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. +// B6.one({required C5 super.f}); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:60:29: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. +// - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. +// B6.two({required C5 super.f}) : super(); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:73:30: Error: The argument type 'dynamic' can't be assigned to the parameter type 'int'. +// B7({required dynamic super.x1, // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:75:44: Error: The argument type 'X Function(Object)' can't be assigned to the parameter type 'bool Function(Object)'. +// - 'Object' is from 'dart:core'. +// required X Function(Object) super.f1, // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:77:42: Error: The argument type 'void Function(X)' can't be assigned to the parameter type 'void Function(dynamic)'. +// required void Function(X) super.g1, // Error. +// ^ +// +import self as self; +import "dart:core" as core; + +class A1 extends core::Object { + constructor •(core::int x) → self::A1 + : super core::Object::•() + ; +} +class B1 extends self::A1 { + constructor one(dynamic x) → self::B1 + : super self::A1::•(invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:10:24: Error: The argument type 'dynamic' can't be assigned to the parameter type 'int'. + B1.one(dynamic super.x); // Error. + ^" in x as{TypeError,ForNonNullableByDefault} core::int) + ; + constructor two(dynamic x) → self::B1 + : super self::A1::•(invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:11:24: Error: The argument type 'dynamic' can't be assigned to the parameter type 'int'. + B1.two(dynamic super.x) : super(); // Error. + ^" in x as{TypeError,ForNonNullableByDefault} core::int) + ; +} +class A2 extends core::Object { + constructor •({required core::String x = #C1}) → self::A2 + : super core::Object::•() + ; +} +class B2 extends self::A2 { + constructor one({required dynamic x = #C1}) → self::B2 + : super self::A2::•(x: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:19:34: Error: The argument type 'dynamic' can't be assigned to the parameter type 'String'. + B2.one({required dynamic super.x}); // Error. + ^" in x as{TypeError,ForNonNullableByDefault} core::String) + ; + constructor two({required dynamic x = #C1}) → self::B2 + : super self::A2::•(x: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:20:34: Error: The argument type 'dynamic' can't be assigned to the parameter type 'String'. + B2.two({required dynamic super.x}) : super(); // Error. + ^" in x as{TypeError,ForNonNullableByDefault} core::String) + ; +} +class A3 extends core::Object { + constructor •((core::double) → core::num f) → self::A3 + : super core::Object::•() + ; +} +class B3 extends self::A3 { + constructor one((core::double) → X% f) → self::B3 + : super self::A3::•(invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:28:38: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. + B3.one(X Function(double) super.f); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::double) → core::num) + ; + constructor two((core::double) → X% f) → self::B3 + : super self::A3::•(invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:29:38: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. + B3.two(X Function(double) super.f) : super(); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::double) → core::num) + ; +} +class A4 extends core::Object { + constructor •({required (core::double) → core::num f = #C1}) → self::A4 + : super core::Object::•() + ; +} +class B4 extends self::A4 { + constructor one({required (core::double) → X% f = #C1}) → self::B4 + : super self::A4::•(f: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:37:48: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. + B4.one({required X Function(double) super.f}); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::double) → core::num) + ; + constructor two({required (core::double) → X% f = #C1}) → self::B4 + : super self::A4::•(f: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:38:48: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. + B4.two({required X Function(double) super.f}) : super(); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::double) → core::num) + ; +} +abstract class C5 extends core::Object { + synthetic constructor •() → self::C5 + : super core::Object::•() + ; + abstract method call(core::int x, core::num y) → core::String; +} +class A5 extends core::Object { + constructor •((core::int, core::num) → core::String f) → self::A5 + : super core::Object::•() + ; +} +class B5 extends self::A5 { + constructor one(self::C5 f) → self::B5 + : super self::A5::•(invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:50:19: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. + - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. + B5.one(C5 super.f); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::int, core::num) → core::String) + ; + constructor two(self::C5 f) → self::B5 + : super self::A5::•(invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:51:19: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. + - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. + B5.two(C5 super.f) : super(); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::int, core::num) → core::String) + ; +} +class A6 extends core::Object { + constructor •({required (core::int, core::num) → core::String f = #C1}) → self::A6 + : super core::Object::•() + ; +} +class B6 extends self::A6 { + constructor one({required self::C5 f = #C1}) → self::B6 + : super self::A6::•(f: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:59:29: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. + - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. + B6.one({required C5 super.f}); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::int, core::num) → core::String) + ; + constructor two({required self::C5 f = #C1}) → self::B6 + : super self::A6::•(f: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:60:29: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. + - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. + B6.two({required C5 super.f}) : super(); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::int, core::num) → core::String) + ; +} +class A7 extends core::Object { + constructor •({required core::int x1 = #C1, required core::int x2 = #C1, required (core::Object) → core::bool f1 = #C1, required (core::Object) → core::bool f2 = #C1, required (dynamic) → void g1 = #C1, required (dynamic) → void g2 = #C1}) → self::A7 + : super core::Object::•() + ; +} +class B7 extends self::A7 { + constructor •({required dynamic x1 = #C1, required dynamic x2 = #C1, required (core::Object) → X% f1 = #C1, required (core::Object) → X% f2 = #C1, required (X%) → void g1 = #C1, required (X%) → void g2 = #C1}) → self::B7 + : super self::A7::•(x2: x2 as{TypeError,ForDynamic,ForNonNullableByDefault} core::int, f2: f2, g2: g2, x1: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:73:30: Error: The argument type 'dynamic' can't be assigned to the parameter type 'int'. + B7({required dynamic super.x1, // Error. + ^" in x1 as{TypeError,ForNonNullableByDefault} core::int, f1: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:75:44: Error: The argument type 'X Function(Object)' can't be assigned to the parameter type 'bool Function(Object)'. + - 'Object' is from 'dart:core'. + required X Function(Object) super.f1, // Error. + ^" in f1 as{TypeError,ForNonNullableByDefault} (core::Object) → core::bool, g1: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:77:42: Error: The argument type 'void Function(X)' can't be assigned to the parameter type 'void Function(dynamic)'. + required void Function(X) super.g1, // Error. + ^" in g1 as{TypeError,ForNonNullableByDefault} (dynamic) → void) + ; +} +static method main() → dynamic {} + +constants { + #C1 = null +} diff --git a/pkg/front_end/testcases/super_parameters/no_coercions.dart.weak.outline.expect b/pkg/front_end/testcases/super_parameters/no_coercions.dart.weak.outline.expect new file mode 100644 index 000000000000..7a8c89a1a44a --- /dev/null +++ b/pkg/front_end/testcases/super_parameters/no_coercions.dart.weak.outline.expect @@ -0,0 +1,79 @@ +library /*isNonNullableByDefault*/; +import self as self; +import "dart:core" as core; + +class A1 extends core::Object { + constructor •(core::int x) → self::A1 + ; +} +class B1 extends self::A1 { + constructor one(dynamic x) → self::B1 + ; + constructor two(dynamic x) → self::B1 + ; +} +class A2 extends core::Object { + constructor •({required core::String x}) → self::A2 + ; +} +class B2 extends self::A2 { + constructor one({required dynamic x}) → self::B2 + ; + constructor two({required dynamic x}) → self::B2 + ; +} +class A3 extends core::Object { + constructor •((core::double) → core::num f) → self::A3 + ; +} +class B3 extends self::A3 { + constructor one((core::double) → X% f) → self::B3 + ; + constructor two((core::double) → X% f) → self::B3 + ; +} +class A4 extends core::Object { + constructor •({required (core::double) → core::num f}) → self::A4 + ; +} +class B4 extends self::A4 { + constructor one({required (core::double) → X% f}) → self::B4 + ; + constructor two({required (core::double) → X% f}) → self::B4 + ; +} +abstract class C5 extends core::Object { + synthetic constructor •() → self::C5 + ; + abstract method call(core::int x, core::num y) → core::String; +} +class A5 extends core::Object { + constructor •((core::int, core::num) → core::String f) → self::A5 + ; +} +class B5 extends self::A5 { + constructor one(self::C5 f) → self::B5 + ; + constructor two(self::C5 f) → self::B5 + ; +} +class A6 extends core::Object { + constructor •({required (core::int, core::num) → core::String f}) → self::A6 + ; +} +class B6 extends self::A6 { + constructor one({required self::C5 f}) → self::B6 + ; + constructor two({required self::C5 f}) → self::B6 + ; +} +class A7 extends core::Object { + constructor •({required core::int x1, required core::int x2, required (core::Object) → core::bool f1, required (core::Object) → core::bool f2, required (dynamic) → void g1, required (dynamic) → void g2}) → self::A7 + ; +} +class B7 extends self::A7 { + constructor •({required dynamic x1, required dynamic x2, required (core::Object) → X% f1, required (core::Object) → X% f2, required (X%) → void g1, required (X%) → void g2}) → self::B7 + ; +} +static method main() → dynamic + ; diff --git a/pkg/front_end/testcases/super_parameters/no_coercions.dart.weak.transformed.expect b/pkg/front_end/testcases/super_parameters/no_coercions.dart.weak.transformed.expect new file mode 100644 index 000000000000..1d154d826fab --- /dev/null +++ b/pkg/front_end/testcases/super_parameters/no_coercions.dart.weak.transformed.expect @@ -0,0 +1,206 @@ +library /*isNonNullableByDefault*/; +// +// Problems in library: +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:10:24: Error: The argument type 'dynamic' can't be assigned to the parameter type 'int'. +// B1.one(dynamic super.x); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:11:24: Error: The argument type 'dynamic' can't be assigned to the parameter type 'int'. +// B1.two(dynamic super.x) : super(); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:19:34: Error: The argument type 'dynamic' can't be assigned to the parameter type 'String'. +// B2.one({required dynamic super.x}); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:20:34: Error: The argument type 'dynamic' can't be assigned to the parameter type 'String'. +// B2.two({required dynamic super.x}) : super(); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:28:38: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. +// B3.one(X Function(double) super.f); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:29:38: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. +// B3.two(X Function(double) super.f) : super(); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:37:48: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. +// B4.one({required X Function(double) super.f}); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:38:48: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. +// B4.two({required X Function(double) super.f}) : super(); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:50:19: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. +// - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. +// B5.one(C5 super.f); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:51:19: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. +// - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. +// B5.two(C5 super.f) : super(); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:59:29: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. +// - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. +// B6.one({required C5 super.f}); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:60:29: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. +// - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. +// B6.two({required C5 super.f}) : super(); // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:73:30: Error: The argument type 'dynamic' can't be assigned to the parameter type 'int'. +// B7({required dynamic super.x1, // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:75:44: Error: The argument type 'X Function(Object)' can't be assigned to the parameter type 'bool Function(Object)'. +// - 'Object' is from 'dart:core'. +// required X Function(Object) super.f1, // Error. +// ^ +// +// pkg/front_end/testcases/super_parameters/no_coercions.dart:77:42: Error: The argument type 'void Function(X)' can't be assigned to the parameter type 'void Function(dynamic)'. +// required void Function(X) super.g1, // Error. +// ^ +// +import self as self; +import "dart:core" as core; + +class A1 extends core::Object { + constructor •(core::int x) → self::A1 + : super core::Object::•() + ; +} +class B1 extends self::A1 { + constructor one(dynamic x) → self::B1 + : super self::A1::•(invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:10:24: Error: The argument type 'dynamic' can't be assigned to the parameter type 'int'. + B1.one(dynamic super.x); // Error. + ^" in x as{TypeError,ForNonNullableByDefault} core::int) + ; + constructor two(dynamic x) → self::B1 + : super self::A1::•(invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:11:24: Error: The argument type 'dynamic' can't be assigned to the parameter type 'int'. + B1.two(dynamic super.x) : super(); // Error. + ^" in x as{TypeError,ForNonNullableByDefault} core::int) + ; +} +class A2 extends core::Object { + constructor •({required core::String x = #C1}) → self::A2 + : super core::Object::•() + ; +} +class B2 extends self::A2 { + constructor one({required dynamic x = #C1}) → self::B2 + : super self::A2::•(x: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:19:34: Error: The argument type 'dynamic' can't be assigned to the parameter type 'String'. + B2.one({required dynamic super.x}); // Error. + ^" in x as{TypeError,ForNonNullableByDefault} core::String) + ; + constructor two({required dynamic x = #C1}) → self::B2 + : super self::A2::•(x: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:20:34: Error: The argument type 'dynamic' can't be assigned to the parameter type 'String'. + B2.two({required dynamic super.x}) : super(); // Error. + ^" in x as{TypeError,ForNonNullableByDefault} core::String) + ; +} +class A3 extends core::Object { + constructor •((core::double) → core::num f) → self::A3 + : super core::Object::•() + ; +} +class B3 extends self::A3 { + constructor one((core::double) → X% f) → self::B3 + : super self::A3::•(invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:28:38: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. + B3.one(X Function(double) super.f); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::double) → core::num) + ; + constructor two((core::double) → X% f) → self::B3 + : super self::A3::•(invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:29:38: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. + B3.two(X Function(double) super.f) : super(); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::double) → core::num) + ; +} +class A4 extends core::Object { + constructor •({required (core::double) → core::num f = #C1}) → self::A4 + : super core::Object::•() + ; +} +class B4 extends self::A4 { + constructor one({required (core::double) → X% f = #C1}) → self::B4 + : super self::A4::•(f: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:37:48: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. + B4.one({required X Function(double) super.f}); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::double) → core::num) + ; + constructor two({required (core::double) → X% f = #C1}) → self::B4 + : super self::A4::•(f: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:38:48: Error: The argument type 'X Function(double)' can't be assigned to the parameter type 'num Function(double)'. + B4.two({required X Function(double) super.f}) : super(); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::double) → core::num) + ; +} +abstract class C5 extends core::Object { + synthetic constructor •() → self::C5 + : super core::Object::•() + ; + abstract method call(core::int x, core::num y) → core::String; +} +class A5 extends core::Object { + constructor •((core::int, core::num) → core::String f) → self::A5 + : super core::Object::•() + ; +} +class B5 extends self::A5 { + constructor one(self::C5 f) → self::B5 + : super self::A5::•(invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:50:19: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. + - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. + B5.one(C5 super.f); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::int, core::num) → core::String) + ; + constructor two(self::C5 f) → self::B5 + : super self::A5::•(invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:51:19: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. + - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. + B5.two(C5 super.f) : super(); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::int, core::num) → core::String) + ; +} +class A6 extends core::Object { + constructor •({required (core::int, core::num) → core::String f = #C1}) → self::A6 + : super core::Object::•() + ; +} +class B6 extends self::A6 { + constructor one({required self::C5 f = #C1}) → self::B6 + : super self::A6::•(f: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:59:29: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. + - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. + B6.one({required C5 super.f}); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::int, core::num) → core::String) + ; + constructor two({required self::C5 f = #C1}) → self::B6 + : super self::A6::•(f: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:60:29: Error: The argument type 'C5' can't be assigned to the parameter type 'String Function(int, num)'. + - 'C5' is from 'pkg/front_end/testcases/super_parameters/no_coercions.dart'. + B6.two({required C5 super.f}) : super(); // Error. + ^" in f as{TypeError,ForNonNullableByDefault} (core::int, core::num) → core::String) + ; +} +class A7 extends core::Object { + constructor •({required core::int x1 = #C1, required core::int x2 = #C1, required (core::Object) → core::bool f1 = #C1, required (core::Object) → core::bool f2 = #C1, required (dynamic) → void g1 = #C1, required (dynamic) → void g2 = #C1}) → self::A7 + : super core::Object::•() + ; +} +class B7 extends self::A7 { + constructor •({required dynamic x1 = #C1, required dynamic x2 = #C1, required (core::Object) → X% f1 = #C1, required (core::Object) → X% f2 = #C1, required (X%) → void g1 = #C1, required (X%) → void g2 = #C1}) → self::B7 + : super self::A7::•(x2: x2 as{TypeError,ForDynamic,ForNonNullableByDefault} core::int, f2: f2, g2: g2, x1: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:73:30: Error: The argument type 'dynamic' can't be assigned to the parameter type 'int'. + B7({required dynamic super.x1, // Error. + ^" in x1 as{TypeError,ForNonNullableByDefault} core::int, f1: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:75:44: Error: The argument type 'X Function(Object)' can't be assigned to the parameter type 'bool Function(Object)'. + - 'Object' is from 'dart:core'. + required X Function(Object) super.f1, // Error. + ^" in f1 as{TypeError,ForNonNullableByDefault} (core::Object) → core::bool, g1: invalid-expression "pkg/front_end/testcases/super_parameters/no_coercions.dart:77:42: Error: The argument type 'void Function(X)' can't be assigned to the parameter type 'void Function(dynamic)'. + required void Function(X) super.g1, // Error. + ^" in g1 as{TypeError,ForNonNullableByDefault} (dynamic) → void) + ; +} +static method main() → dynamic {} + +constants { + #C1 = null +}