diff --git a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart index 0e88d0edd5f..a2806c1539b 100644 --- a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart +++ b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart @@ -1755,6 +1755,18 @@ const MessageCode messageConstructorNotSync = const MessageCode( message: r"""Constructor bodies can't use 'async', 'async*', or 'sync*'."""); +// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. +const Code codeConstructorTearOffWithTypeArguments = + messageConstructorTearOffWithTypeArguments; + +// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. +const MessageCode messageConstructorTearOffWithTypeArguments = const MessageCode( + "ConstructorTearOffWithTypeArguments", + message: + r"""A constructor tear-off can't have type arguments after the constructor name.""", + tip: + r"""Try removing the type arguments or placing them after the class name."""); + // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. const Code codeConstructorWithReturnType = messageConstructorWithReturnType; @@ -1775,8 +1787,9 @@ const MessageCode messageConstructorWithTypeArguments = const MessageCode( "ConstructorWithTypeArguments", analyzerCodes: ["WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR"], message: - r"""A constructor invocation can't have type arguments on the constructor name.""", - tip: r"""Try to place the type arguments on the class name."""); + r"""A constructor invocation can't have type arguments after the constructor name.""", + tip: + r"""Try removing the type arguments or placing them after the class name."""); // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. const Code codeConstructorWithTypeParameters = 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 432f847b499..c90bb311149 100644 --- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart +++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart @@ -6365,6 +6365,11 @@ class BodyBuilder extends ScopeListener if (operand is Generator) { push(operand.applyTypeArguments( openAngleBracket.charOffset, typeArguments)); + } else if (operand is StaticTearOff && operand.target.isFactory || + operand is ConstructorTearOff || + operand is RedirectingFactoryTearOff) { + push(buildProblem(fasta.messageConstructorTearOffWithTypeArguments, + openAngleBracket.charOffset, noLength)); } else { push(new Instantiation( toValue(operand), buildDartTypeArguments(typeArguments)) diff --git a/pkg/front_end/messages.status b/pkg/front_end/messages.status index daf3f6c41f3..0f446e2ff8f 100644 --- a/pkg/front_end/messages.status +++ b/pkg/front_end/messages.status @@ -150,6 +150,7 @@ ConstEvalZeroDivisor/example: Fail ConstFieldWithoutInitializer/example: Fail ConstructorNotFound/example: Fail ConstructorNotSync/example: Fail +ConstructorTearOffWithTypeArguments/analyzerCode: Fail ContinueLabelNotTarget/example: Fail ContinueOutsideOfLoop/part_wrapped_script1: Fail ContinueOutsideOfLoop/script1: Fail diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml index 8795748eaee..681d3b4d62d 100644 --- a/pkg/front_end/messages.yaml +++ b/pkg/front_end/messages.yaml @@ -1625,8 +1625,8 @@ ConstructorWithTypeParameters: } ConstructorWithTypeArguments: - template: "A constructor invocation can't have type arguments on the constructor name." - tip: "Try to place the type arguments on the class name." + template: "A constructor invocation can't have type arguments after the constructor name." + tip: "Try removing the type arguments or placing them after the class name." analyzerCode: WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR script: - "class C { C.foo(); } bar() { new C.foo(); }" @@ -5262,3 +5262,11 @@ StaticTearOffFromInstantiatedClass: script: | class A { static f() {} } main() => A.f; + + +ConstructorTearOffWithTypeArguments: + template: "A constructor tear-off can't have type arguments after the constructor name." + tip: "Try removing the type arguments or placing them after the class name." + experiments: constructor-tearoffs + script: + - "class C { C.foo(); } bar() { C.foo; }" diff --git a/pkg/front_end/testcases/constructor_tearoffs/issue46890.dart b/pkg/front_end/testcases/constructor_tearoffs/issue46890.dart new file mode 100644 index 00000000000..7a71462efbc --- /dev/null +++ b/pkg/front_end/testcases/constructor_tearoffs/issue46890.dart @@ -0,0 +1,28 @@ +// Copyright (c) 2021, 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 A { + A.foo() {} + factory A.bar() => new A.foo(); + factory A.baz() = A.bar; +} + +test() { + List.filled; // Ok. + A.foo; // Ok. + A.bar; // Ok. + A.baz; // Ok. + + List.filled; // Ok. + A.foo; // Ok. + A.bar; // Ok. + A.baz; // Ok. + + List.filled; // Error. + A.foo; // Error. + A.bar; // Error. + A.baz; // Error. +} + +main() {} diff --git a/pkg/front_end/testcases/constructor_tearoffs/issue46890.dart.strong.expect b/pkg/front_end/testcases/constructor_tearoffs/issue46890.dart.strong.expect new file mode 100644 index 00000000000..837ac1a61c0 --- /dev/null +++ b/pkg/front_end/testcases/constructor_tearoffs/issue46890.dart.strong.expect @@ -0,0 +1,74 @@ +library /*isNonNullableByDefault*/; +// +// Problems in library: +// +// pkg/front_end/testcases/constructor_tearoffs/issue46890.dart:22:14: Error: A constructor tear-off can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. +// List.filled; // Error. +// ^ +// +// pkg/front_end/testcases/constructor_tearoffs/issue46890.dart:23:8: Error: A constructor tear-off can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. +// A.foo; // Error. +// ^ +// +// pkg/front_end/testcases/constructor_tearoffs/issue46890.dart:24:8: Error: A constructor tear-off can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. +// A.bar; // Error. +// ^ +// +// pkg/front_end/testcases/constructor_tearoffs/issue46890.dart:25:8: Error: A constructor tear-off can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. +// A.baz; // Error. +// ^ +// +import self as self; +import "dart:core" as core; + +class A extends core::Object { + static final field dynamic _redirecting# = [self::A::baz]/*isLegacy*/; + constructor foo() → self::A + : super core::Object::•() {} + static factory bar() → self::A + return new self::A::foo(); + static factory baz() → self::A + return self::A::bar(); +} +static method test() → dynamic { + #C1; + #C2; + #C3; + #C4; + #C5; + #C6; + #C7; + #C8; + invalid-expression "pkg/front_end/testcases/constructor_tearoffs/issue46890.dart:22:14: Error: A constructor tear-off can't have type arguments after the constructor name. +Try removing the type arguments or placing them after the class name. + List.filled; // Error. + ^"; + invalid-expression "pkg/front_end/testcases/constructor_tearoffs/issue46890.dart:23:8: Error: A constructor tear-off can't have type arguments after the constructor name. +Try removing the type arguments or placing them after the class name. + A.foo; // Error. + ^"; + invalid-expression "pkg/front_end/testcases/constructor_tearoffs/issue46890.dart:24:8: Error: A constructor tear-off can't have type arguments after the constructor name. +Try removing the type arguments or placing them after the class name. + A.bar; // Error. + ^"; + invalid-expression "pkg/front_end/testcases/constructor_tearoffs/issue46890.dart:25:8: Error: A constructor tear-off can't have type arguments after the constructor name. +Try removing the type arguments or placing them after the class name. + A.baz; // Error. + ^"; +} +static method main() → dynamic {} + +constants { + #C1 = static-tearoff core::List::filled + #C2 = constructor-tearoff self::A::foo + #C3 = static-tearoff self::A::bar + #C4 = redirecting-factory-tearoff self::A::baz + #C5 = instantiation core::List::filled + #C6 = instantiation self::A::foo + #C7 = instantiation self::A::bar + #C8 = instantiation self::A::baz +} diff --git a/pkg/front_end/testcases/constructor_tearoffs/issue46890.dart.strong.transformed.expect b/pkg/front_end/testcases/constructor_tearoffs/issue46890.dart.strong.transformed.expect new file mode 100644 index 00000000000..837ac1a61c0 --- /dev/null +++ b/pkg/front_end/testcases/constructor_tearoffs/issue46890.dart.strong.transformed.expect @@ -0,0 +1,74 @@ +library /*isNonNullableByDefault*/; +// +// Problems in library: +// +// pkg/front_end/testcases/constructor_tearoffs/issue46890.dart:22:14: Error: A constructor tear-off can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. +// List.filled; // Error. +// ^ +// +// pkg/front_end/testcases/constructor_tearoffs/issue46890.dart:23:8: Error: A constructor tear-off can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. +// A.foo; // Error. +// ^ +// +// pkg/front_end/testcases/constructor_tearoffs/issue46890.dart:24:8: Error: A constructor tear-off can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. +// A.bar; // Error. +// ^ +// +// pkg/front_end/testcases/constructor_tearoffs/issue46890.dart:25:8: Error: A constructor tear-off can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. +// A.baz; // Error. +// ^ +// +import self as self; +import "dart:core" as core; + +class A extends core::Object { + static final field dynamic _redirecting# = [self::A::baz]/*isLegacy*/; + constructor foo() → self::A + : super core::Object::•() {} + static factory bar() → self::A + return new self::A::foo(); + static factory baz() → self::A + return self::A::bar(); +} +static method test() → dynamic { + #C1; + #C2; + #C3; + #C4; + #C5; + #C6; + #C7; + #C8; + invalid-expression "pkg/front_end/testcases/constructor_tearoffs/issue46890.dart:22:14: Error: A constructor tear-off can't have type arguments after the constructor name. +Try removing the type arguments or placing them after the class name. + List.filled; // Error. + ^"; + invalid-expression "pkg/front_end/testcases/constructor_tearoffs/issue46890.dart:23:8: Error: A constructor tear-off can't have type arguments after the constructor name. +Try removing the type arguments or placing them after the class name. + A.foo; // Error. + ^"; + invalid-expression "pkg/front_end/testcases/constructor_tearoffs/issue46890.dart:24:8: Error: A constructor tear-off can't have type arguments after the constructor name. +Try removing the type arguments or placing them after the class name. + A.bar; // Error. + ^"; + invalid-expression "pkg/front_end/testcases/constructor_tearoffs/issue46890.dart:25:8: Error: A constructor tear-off can't have type arguments after the constructor name. +Try removing the type arguments or placing them after the class name. + A.baz; // Error. + ^"; +} +static method main() → dynamic {} + +constants { + #C1 = static-tearoff core::List::filled + #C2 = constructor-tearoff self::A::foo + #C3 = static-tearoff self::A::bar + #C4 = redirecting-factory-tearoff self::A::baz + #C5 = instantiation core::List::filled + #C6 = instantiation self::A::foo + #C7 = instantiation self::A::bar + #C8 = instantiation self::A::baz +} diff --git a/pkg/front_end/testcases/constructor_tearoffs/issue46890.dart.textual_outline.expect b/pkg/front_end/testcases/constructor_tearoffs/issue46890.dart.textual_outline.expect new file mode 100644 index 00000000000..97889d683d7 --- /dev/null +++ b/pkg/front_end/testcases/constructor_tearoffs/issue46890.dart.textual_outline.expect @@ -0,0 +1,8 @@ +class A { + A.foo() {} + factory A.bar() => new A.foo(); + factory A.baz() = A.bar; +} + +test() {} +main() {} diff --git a/pkg/front_end/testcases/constructor_tearoffs/issue46890.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/constructor_tearoffs/issue46890.dart.textual_outline_modelled.expect new file mode 100644 index 00000000000..dd5c918126c --- /dev/null +++ b/pkg/front_end/testcases/constructor_tearoffs/issue46890.dart.textual_outline_modelled.expect @@ -0,0 +1,8 @@ +class A { + A.foo() {} + factory A.bar() => new A.foo(); + factory A.baz() = A.bar; +} + +main() {} +test() {} diff --git a/pkg/front_end/testcases/constructor_tearoffs/issue46890.dart.weak.expect b/pkg/front_end/testcases/constructor_tearoffs/issue46890.dart.weak.expect new file mode 100644 index 00000000000..1d39c74dcd3 --- /dev/null +++ b/pkg/front_end/testcases/constructor_tearoffs/issue46890.dart.weak.expect @@ -0,0 +1,74 @@ +library /*isNonNullableByDefault*/; +// +// Problems in library: +// +// pkg/front_end/testcases/constructor_tearoffs/issue46890.dart:22:14: Error: A constructor tear-off can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. +// List.filled; // Error. +// ^ +// +// pkg/front_end/testcases/constructor_tearoffs/issue46890.dart:23:8: Error: A constructor tear-off can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. +// A.foo; // Error. +// ^ +// +// pkg/front_end/testcases/constructor_tearoffs/issue46890.dart:24:8: Error: A constructor tear-off can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. +// A.bar; // Error. +// ^ +// +// pkg/front_end/testcases/constructor_tearoffs/issue46890.dart:25:8: Error: A constructor tear-off can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. +// A.baz; // Error. +// ^ +// +import self as self; +import "dart:core" as core; + +class A extends core::Object { + static final field dynamic _redirecting# = [self::A::baz]/*isLegacy*/; + constructor foo() → self::A + : super core::Object::•() {} + static factory bar() → self::A + return new self::A::foo(); + static factory baz() → self::A + return self::A::bar(); +} +static method test() → dynamic { + #C1; + #C2; + #C3; + #C4; + #C5; + #C6; + #C7; + #C8; + invalid-expression "pkg/front_end/testcases/constructor_tearoffs/issue46890.dart:22:14: Error: A constructor tear-off can't have type arguments after the constructor name. +Try removing the type arguments or placing them after the class name. + List.filled; // Error. + ^"; + invalid-expression "pkg/front_end/testcases/constructor_tearoffs/issue46890.dart:23:8: Error: A constructor tear-off can't have type arguments after the constructor name. +Try removing the type arguments or placing them after the class name. + A.foo; // Error. + ^"; + invalid-expression "pkg/front_end/testcases/constructor_tearoffs/issue46890.dart:24:8: Error: A constructor tear-off can't have type arguments after the constructor name. +Try removing the type arguments or placing them after the class name. + A.bar; // Error. + ^"; + invalid-expression "pkg/front_end/testcases/constructor_tearoffs/issue46890.dart:25:8: Error: A constructor tear-off can't have type arguments after the constructor name. +Try removing the type arguments or placing them after the class name. + A.baz; // Error. + ^"; +} +static method main() → dynamic {} + +constants { + #C1 = static-tearoff core::List::filled + #C2 = constructor-tearoff self::A::foo + #C3 = static-tearoff self::A::bar + #C4 = redirecting-factory-tearoff self::A::baz + #C5 = instantiation core::List::filled + #C6 = instantiation self::A::foo + #C7 = instantiation self::A::bar + #C8 = instantiation self::A::baz +} diff --git a/pkg/front_end/testcases/constructor_tearoffs/issue46890.dart.weak.outline.expect b/pkg/front_end/testcases/constructor_tearoffs/issue46890.dart.weak.outline.expect new file mode 100644 index 00000000000..e724719b805 --- /dev/null +++ b/pkg/front_end/testcases/constructor_tearoffs/issue46890.dart.weak.outline.expect @@ -0,0 +1,17 @@ +library /*isNonNullableByDefault*/; +import self as self; +import "dart:core" as core; + +class A extends core::Object { + static final field dynamic _redirecting# = [self::A::baz]/*isLegacy*/; + constructor foo() → self::A + ; + static factory bar() → self::A + ; + static factory baz() → self::A + return self::A::bar(); +} +static method test() → dynamic + ; +static method main() → dynamic + ; diff --git a/pkg/front_end/testcases/constructor_tearoffs/issue46890.dart.weak.transformed.expect b/pkg/front_end/testcases/constructor_tearoffs/issue46890.dart.weak.transformed.expect new file mode 100644 index 00000000000..1d39c74dcd3 --- /dev/null +++ b/pkg/front_end/testcases/constructor_tearoffs/issue46890.dart.weak.transformed.expect @@ -0,0 +1,74 @@ +library /*isNonNullableByDefault*/; +// +// Problems in library: +// +// pkg/front_end/testcases/constructor_tearoffs/issue46890.dart:22:14: Error: A constructor tear-off can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. +// List.filled; // Error. +// ^ +// +// pkg/front_end/testcases/constructor_tearoffs/issue46890.dart:23:8: Error: A constructor tear-off can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. +// A.foo; // Error. +// ^ +// +// pkg/front_end/testcases/constructor_tearoffs/issue46890.dart:24:8: Error: A constructor tear-off can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. +// A.bar; // Error. +// ^ +// +// pkg/front_end/testcases/constructor_tearoffs/issue46890.dart:25:8: Error: A constructor tear-off can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. +// A.baz; // Error. +// ^ +// +import self as self; +import "dart:core" as core; + +class A extends core::Object { + static final field dynamic _redirecting# = [self::A::baz]/*isLegacy*/; + constructor foo() → self::A + : super core::Object::•() {} + static factory bar() → self::A + return new self::A::foo(); + static factory baz() → self::A + return self::A::bar(); +} +static method test() → dynamic { + #C1; + #C2; + #C3; + #C4; + #C5; + #C6; + #C7; + #C8; + invalid-expression "pkg/front_end/testcases/constructor_tearoffs/issue46890.dart:22:14: Error: A constructor tear-off can't have type arguments after the constructor name. +Try removing the type arguments or placing them after the class name. + List.filled; // Error. + ^"; + invalid-expression "pkg/front_end/testcases/constructor_tearoffs/issue46890.dart:23:8: Error: A constructor tear-off can't have type arguments after the constructor name. +Try removing the type arguments or placing them after the class name. + A.foo; // Error. + ^"; + invalid-expression "pkg/front_end/testcases/constructor_tearoffs/issue46890.dart:24:8: Error: A constructor tear-off can't have type arguments after the constructor name. +Try removing the type arguments or placing them after the class name. + A.bar; // Error. + ^"; + invalid-expression "pkg/front_end/testcases/constructor_tearoffs/issue46890.dart:25:8: Error: A constructor tear-off can't have type arguments after the constructor name. +Try removing the type arguments or placing them after the class name. + A.baz; // Error. + ^"; +} +static method main() → dynamic {} + +constants { + #C1 = static-tearoff core::List::filled + #C2 = constructor-tearoff self::A::foo + #C3 = static-tearoff self::A::bar + #C4 = redirecting-factory-tearoff self::A::baz + #C5 = instantiation core::List::filled + #C6 = instantiation self::A::foo + #C7 = instantiation self::A::bar + #C8 = instantiation self::A::baz +} diff --git a/pkg/front_end/testcases/regress/issue_34403.dart.weak.expect b/pkg/front_end/testcases/regress/issue_34403.dart.weak.expect index 521393378bc..67d25ff3715 100644 --- a/pkg/front_end/testcases/regress/issue_34403.dart.weak.expect +++ b/pkg/front_end/testcases/regress/issue_34403.dart.weak.expect @@ -2,13 +2,13 @@ library; // // Problems in library: // -// pkg/front_end/testcases/regress/issue_34403.dart:16:14: Error: A constructor invocation can't have type arguments on the constructor name. -// Try to place the type arguments on the class name. +// pkg/front_end/testcases/regress/issue_34403.dart:16:14: Error: A constructor invocation can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. // var c1 = C.bar(); // ^^^ // -// pkg/front_end/testcases/regress/issue_34403.dart:18:18: Error: A constructor invocation can't have type arguments on the constructor name. -// Try to place the type arguments on the class name. +// pkg/front_end/testcases/regress/issue_34403.dart:18:18: Error: A constructor invocation can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. // var c2 = new C.bar(); // ^^^ // @@ -17,23 +17,23 @@ library; // var c3 = C.bar(); // ^ // -// pkg/front_end/testcases/regress/issue_34403.dart:20:22: Error: A constructor invocation can't have type arguments on the constructor name. -// Try to place the type arguments on the class name. +// pkg/front_end/testcases/regress/issue_34403.dart:20:22: Error: A constructor invocation can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. // var c3 = C.bar(); // ^^^ // -// pkg/front_end/testcases/regress/issue_34403.dart:22:26: Error: A constructor invocation can't have type arguments on the constructor name. -// Try to place the type arguments on the class name. +// pkg/front_end/testcases/regress/issue_34403.dart:22:26: Error: A constructor invocation can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. // var c4 = new C.bar(); // ^^^ // -// pkg/front_end/testcases/regress/issue_34403.dart:25:16: Error: A constructor invocation can't have type arguments on the constructor name. -// Try to place the type arguments on the class name. +// pkg/front_end/testcases/regress/issue_34403.dart:25:16: Error: A constructor invocation can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. // const d1 = D.foo(); // ^^^ // -// pkg/front_end/testcases/regress/issue_34403.dart:27:22: Error: A constructor invocation can't have type arguments on the constructor name. -// Try to place the type arguments on the class name. +// pkg/front_end/testcases/regress/issue_34403.dart:27:22: Error: A constructor invocation can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. // const d2 = const D.foo(); // ^^^ // @@ -42,23 +42,23 @@ library; // const d3 = D.foo(); // ^ // -// pkg/front_end/testcases/regress/issue_34403.dart:29:24: Error: A constructor invocation can't have type arguments on the constructor name. -// Try to place the type arguments on the class name. +// pkg/front_end/testcases/regress/issue_34403.dart:29:24: Error: A constructor invocation can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. // const d3 = D.foo(); // ^^^ // -// pkg/front_end/testcases/regress/issue_34403.dart:31:30: Error: A constructor invocation can't have type arguments on the constructor name. -// Try to place the type arguments on the class name. +// pkg/front_end/testcases/regress/issue_34403.dart:31:30: Error: A constructor invocation can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. // const d4 = const D.foo(); // ^^^ // -// pkg/front_end/testcases/regress/issue_34403.dart:34:16: Error: A constructor invocation can't have type arguments on the constructor name. -// Try to place the type arguments on the class name. +// pkg/front_end/testcases/regress/issue_34403.dart:34:16: Error: A constructor invocation can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. // var e1 = p.E.bar(); // ^^^ // -// pkg/front_end/testcases/regress/issue_34403.dart:36:20: Error: A constructor invocation can't have type arguments on the constructor name. -// Try to place the type arguments on the class name. +// pkg/front_end/testcases/regress/issue_34403.dart:36:20: Error: A constructor invocation can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. // var e2 = new p.E.bar(); // ^^^ // @@ -67,23 +67,23 @@ library; // var e3 = p.E.bar(); // ^ // -// pkg/front_end/testcases/regress/issue_34403.dart:38:24: Error: A constructor invocation can't have type arguments on the constructor name. -// Try to place the type arguments on the class name. +// pkg/front_end/testcases/regress/issue_34403.dart:38:24: Error: A constructor invocation can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. // var e3 = p.E.bar(); // ^^^ // -// pkg/front_end/testcases/regress/issue_34403.dart:40:28: Error: A constructor invocation can't have type arguments on the constructor name. -// Try to place the type arguments on the class name. +// pkg/front_end/testcases/regress/issue_34403.dart:40:28: Error: A constructor invocation can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. // var e4 = new p.E.bar(); // ^^^ // -// pkg/front_end/testcases/regress/issue_34403.dart:43:18: Error: A constructor invocation can't have type arguments on the constructor name. -// Try to place the type arguments on the class name. +// pkg/front_end/testcases/regress/issue_34403.dart:43:18: Error: A constructor invocation can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. // const f1 = p.F.foo(); // ^^^ // -// pkg/front_end/testcases/regress/issue_34403.dart:45:24: Error: A constructor invocation can't have type arguments on the constructor name. -// Try to place the type arguments on the class name. +// pkg/front_end/testcases/regress/issue_34403.dart:45:24: Error: A constructor invocation can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. // const f2 = const p.F.foo(); // ^^^ // @@ -92,13 +92,13 @@ library; // const f3 = p.F.foo(); // ^ // -// pkg/front_end/testcases/regress/issue_34403.dart:47:26: Error: A constructor invocation can't have type arguments on the constructor name. -// Try to place the type arguments on the class name. +// pkg/front_end/testcases/regress/issue_34403.dart:47:26: Error: A constructor invocation can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. // const f3 = p.F.foo(); // ^^^ // -// pkg/front_end/testcases/regress/issue_34403.dart:49:32: Error: A constructor invocation can't have type arguments on the constructor name. -// Try to place the type arguments on the class name. +// pkg/front_end/testcases/regress/issue_34403.dart:49:32: Error: A constructor invocation can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. // const f4 = const p.F.foo(); // ^^^ // diff --git a/pkg/front_end/testcases/regress/issue_34403.dart.weak.transformed.expect b/pkg/front_end/testcases/regress/issue_34403.dart.weak.transformed.expect index 521393378bc..67d25ff3715 100644 --- a/pkg/front_end/testcases/regress/issue_34403.dart.weak.transformed.expect +++ b/pkg/front_end/testcases/regress/issue_34403.dart.weak.transformed.expect @@ -2,13 +2,13 @@ library; // // Problems in library: // -// pkg/front_end/testcases/regress/issue_34403.dart:16:14: Error: A constructor invocation can't have type arguments on the constructor name. -// Try to place the type arguments on the class name. +// pkg/front_end/testcases/regress/issue_34403.dart:16:14: Error: A constructor invocation can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. // var c1 = C.bar(); // ^^^ // -// pkg/front_end/testcases/regress/issue_34403.dart:18:18: Error: A constructor invocation can't have type arguments on the constructor name. -// Try to place the type arguments on the class name. +// pkg/front_end/testcases/regress/issue_34403.dart:18:18: Error: A constructor invocation can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. // var c2 = new C.bar(); // ^^^ // @@ -17,23 +17,23 @@ library; // var c3 = C.bar(); // ^ // -// pkg/front_end/testcases/regress/issue_34403.dart:20:22: Error: A constructor invocation can't have type arguments on the constructor name. -// Try to place the type arguments on the class name. +// pkg/front_end/testcases/regress/issue_34403.dart:20:22: Error: A constructor invocation can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. // var c3 = C.bar(); // ^^^ // -// pkg/front_end/testcases/regress/issue_34403.dart:22:26: Error: A constructor invocation can't have type arguments on the constructor name. -// Try to place the type arguments on the class name. +// pkg/front_end/testcases/regress/issue_34403.dart:22:26: Error: A constructor invocation can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. // var c4 = new C.bar(); // ^^^ // -// pkg/front_end/testcases/regress/issue_34403.dart:25:16: Error: A constructor invocation can't have type arguments on the constructor name. -// Try to place the type arguments on the class name. +// pkg/front_end/testcases/regress/issue_34403.dart:25:16: Error: A constructor invocation can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. // const d1 = D.foo(); // ^^^ // -// pkg/front_end/testcases/regress/issue_34403.dart:27:22: Error: A constructor invocation can't have type arguments on the constructor name. -// Try to place the type arguments on the class name. +// pkg/front_end/testcases/regress/issue_34403.dart:27:22: Error: A constructor invocation can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. // const d2 = const D.foo(); // ^^^ // @@ -42,23 +42,23 @@ library; // const d3 = D.foo(); // ^ // -// pkg/front_end/testcases/regress/issue_34403.dart:29:24: Error: A constructor invocation can't have type arguments on the constructor name. -// Try to place the type arguments on the class name. +// pkg/front_end/testcases/regress/issue_34403.dart:29:24: Error: A constructor invocation can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. // const d3 = D.foo(); // ^^^ // -// pkg/front_end/testcases/regress/issue_34403.dart:31:30: Error: A constructor invocation can't have type arguments on the constructor name. -// Try to place the type arguments on the class name. +// pkg/front_end/testcases/regress/issue_34403.dart:31:30: Error: A constructor invocation can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. // const d4 = const D.foo(); // ^^^ // -// pkg/front_end/testcases/regress/issue_34403.dart:34:16: Error: A constructor invocation can't have type arguments on the constructor name. -// Try to place the type arguments on the class name. +// pkg/front_end/testcases/regress/issue_34403.dart:34:16: Error: A constructor invocation can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. // var e1 = p.E.bar(); // ^^^ // -// pkg/front_end/testcases/regress/issue_34403.dart:36:20: Error: A constructor invocation can't have type arguments on the constructor name. -// Try to place the type arguments on the class name. +// pkg/front_end/testcases/regress/issue_34403.dart:36:20: Error: A constructor invocation can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. // var e2 = new p.E.bar(); // ^^^ // @@ -67,23 +67,23 @@ library; // var e3 = p.E.bar(); // ^ // -// pkg/front_end/testcases/regress/issue_34403.dart:38:24: Error: A constructor invocation can't have type arguments on the constructor name. -// Try to place the type arguments on the class name. +// pkg/front_end/testcases/regress/issue_34403.dart:38:24: Error: A constructor invocation can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. // var e3 = p.E.bar(); // ^^^ // -// pkg/front_end/testcases/regress/issue_34403.dart:40:28: Error: A constructor invocation can't have type arguments on the constructor name. -// Try to place the type arguments on the class name. +// pkg/front_end/testcases/regress/issue_34403.dart:40:28: Error: A constructor invocation can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. // var e4 = new p.E.bar(); // ^^^ // -// pkg/front_end/testcases/regress/issue_34403.dart:43:18: Error: A constructor invocation can't have type arguments on the constructor name. -// Try to place the type arguments on the class name. +// pkg/front_end/testcases/regress/issue_34403.dart:43:18: Error: A constructor invocation can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. // const f1 = p.F.foo(); // ^^^ // -// pkg/front_end/testcases/regress/issue_34403.dart:45:24: Error: A constructor invocation can't have type arguments on the constructor name. -// Try to place the type arguments on the class name. +// pkg/front_end/testcases/regress/issue_34403.dart:45:24: Error: A constructor invocation can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. // const f2 = const p.F.foo(); // ^^^ // @@ -92,13 +92,13 @@ library; // const f3 = p.F.foo(); // ^ // -// pkg/front_end/testcases/regress/issue_34403.dart:47:26: Error: A constructor invocation can't have type arguments on the constructor name. -// Try to place the type arguments on the class name. +// pkg/front_end/testcases/regress/issue_34403.dart:47:26: Error: A constructor invocation can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. // const f3 = p.F.foo(); // ^^^ // -// pkg/front_end/testcases/regress/issue_34403.dart:49:32: Error: A constructor invocation can't have type arguments on the constructor name. -// Try to place the type arguments on the class name. +// pkg/front_end/testcases/regress/issue_34403.dart:49:32: Error: A constructor invocation can't have type arguments after the constructor name. +// Try removing the type arguments or placing them after the class name. // const f4 = const p.F.foo(); // ^^^ // diff --git a/tests/language/constructor/named_constructor_test.dart b/tests/language/constructor/named_constructor_test.dart index 3b8af32ad48..dec22c82a5a 100644 --- a/tests/language/constructor/named_constructor_test.dart +++ b/tests/language/constructor/named_constructor_test.dart @@ -22,7 +22,7 @@ void main() { // 'Class.named' is not a type: new Class.named().value; // ^ - // [cfe] A constructor invocation can't have type arguments on the constructor name. + // [cfe] A constructor invocation can't have type arguments after the constructor name. // ^^^^^ // [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR @@ -30,7 +30,7 @@ void main() { new Class.named().value; // ^^^^^ // [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR - // [cfe] A constructor invocation can't have type arguments on the constructor name. + // [cfe] A constructor invocation can't have type arguments after the constructor name. new prefix.Class().value; // 'prefix' is not a type: @@ -46,7 +46,7 @@ void main() { // [cfe] Method not found: 'prefix.Class'. // ^^^^^ // [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR - // [cfe] A constructor invocation can't have type arguments on the constructor name. + // [cfe] A constructor invocation can't have type arguments after the constructor name. new prefix.Class.named().value; // 'prefix.Class.named' doesn't fit the grammar syntax T.id: @@ -65,7 +65,7 @@ void main() { new prefix.Class.named().value; // ^^^^^ // [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR - // [cfe] A constructor invocation can't have type arguments on the constructor name. + // [cfe] A constructor invocation can't have type arguments after the constructor name. // 'prefix.Class' doesn't fit the grammar syntax T.id: new prefix.Class.named().value; @@ -74,7 +74,7 @@ void main() { // [cfe] Method not found: 'prefix.Class'. // ^^^^^ // [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR - // [cfe] A constructor invocation can't have type arguments on the constructor name. + // [cfe] A constructor invocation can't have type arguments after the constructor name. // 'prefix.Class.named' doesn't fit the grammar syntax T.id: @@ -91,7 +91,7 @@ void main() { new prefix.Class.named().value; // ^^^^^ // [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR - // [cfe] A constructor invocation can't have type arguments on the constructor name. + // [cfe] A constructor invocation can't have type arguments after the constructor name. // 'prefix.Class.named' doesn't fit the grammar syntax T.id: new prefix.Class.named().value; @@ -100,5 +100,5 @@ void main() { // [cfe] Method not found: 'prefix.Class'. // ^^^^^ // [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR - // [cfe] A constructor invocation can't have type arguments on the constructor name. + // [cfe] A constructor invocation can't have type arguments after the constructor name. } diff --git a/tests/language/constructor/reference_test.dart b/tests/language/constructor/reference_test.dart index 37558808bf1..46892bb4f12 100644 --- a/tests/language/constructor/reference_test.dart +++ b/tests/language/constructor/reference_test.dart @@ -27,14 +27,14 @@ main() { // [cfe] The method 'baz' isn't defined for the class 'Foo'. new Foo.bar(); // ^ - // [cfe] A constructor invocation can't have type arguments on the constructor name. + // [cfe] A constructor invocation can't have type arguments after the constructor name. // ^^^^^ // [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR new Foo.bar.baz(); - // ^ - // [cfe] A constructor invocation can't have type arguments on the constructor name. // ^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.CREATION_WITH_NON_TYPE + // ^ + // [cfe] A constructor invocation can't have type arguments after the constructor name. // ^ // [cfe] Method not found: 'Foo.bar.baz'. new Foo.bar.baz(); @@ -42,8 +42,7 @@ main() { // [analyzer] COMPILE_TIME_ERROR.CREATION_WITH_NON_TYPE // ^^^ // [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR - // [cfe] A constructor invocation can't have type arguments on the constructor name. - // ^ + // [cfe] A constructor invocation can't have type arguments after the constructor name. // [cfe] Method not found: 'Foo.bar.baz'. const Foo(); @@ -64,14 +63,14 @@ main() { // [cfe] The method 'baz' isn't defined for the class 'Foo'. const Foo.bar(); // ^ - // [cfe] A constructor invocation can't have type arguments on the constructor name. + // [cfe] A constructor invocation can't have type arguments after the constructor name. // ^^^^^ // [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR const Foo.bar.baz(); - // ^ - // [cfe] A constructor invocation can't have type arguments on the constructor name. // ^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.CREATION_WITH_NON_TYPE + // ^ + // [cfe] A constructor invocation can't have type arguments after the constructor name. // ^ // [cfe] Method not found: 'Foo.bar.baz'. const Foo.bar.baz(); @@ -79,42 +78,41 @@ main() { // [analyzer] COMPILE_TIME_ERROR.CREATION_WITH_NON_TYPE // ^^^ // [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR - // [cfe] A constructor invocation can't have type arguments on the constructor name. - // ^ + // [cfe] A constructor invocation can't have type arguments after the constructor name. // [cfe] Method not found: 'Foo.bar.baz'. Foo(); Foo.bar(); Foo.bar.baz(); - // ^^^ - // [cfe] Getter not found: 'bar'. - // ^^^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD +// ^ +// [cfe] Getter not found: 'bar'. +// ^^^ +// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD Foo(); Foo.bar(); Foo.bar.baz(); // ^^^^^ // [analyzer] SYNTACTIC_ERROR.EXPERIMENT_NOT_ENABLED // [cfe] This requires the 'constructor-tearoffs' language feature to be enabled. - // ^^^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD // ^ // [cfe] Getter not found: 'bar'. + // ^^^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD Foo.bar(); // ^ - // [cfe] A constructor invocation can't have type arguments on the constructor name. + // [cfe] A constructor invocation can't have type arguments after the constructor name. // ^^^^^ // [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR Foo.bar.baz(); - // ^ - // [cfe] A constructor invocation can't have type arguments on the constructor name. //^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.CREATION_WITH_NON_TYPE - // ^ - // [cfe] Method not found: 'Foo.bar.baz'. +// ^ +// [cfe] A constructor invocation can't have type arguments after the constructor name. +// ^ +// [cfe] Method not found: 'Foo.bar.baz'. Foo.bar.baz(); - // ^^^ - // [cfe] Getter not found: 'bar'. - // ^^^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD +// ^ +// [cfe] Getter not found: 'bar'. +// ^^^ +// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD } diff --git a/tests/language/nonfunction_type_aliases/mixed/usage_object_error_test.dart b/tests/language/nonfunction_type_aliases/mixed/usage_object_error_test.dart index af098beeaf4..505ab32afc0 100644 --- a/tests/language/nonfunction_type_aliases/mixed/usage_object_error_test.dart +++ b/tests/language/nonfunction_type_aliases/mixed/usage_object_error_test.dart @@ -28,28 +28,27 @@ class C1 implements C { abstract class D2 extends C with T {} // ^ // [analyzer] unspecified -// [cfe] unspecified +// [cfe] Can't use 'Object' as a mixin because it has constructors. abstract class D3 implements T {} // ^ // [analyzer] unspecified -// [cfe] unspecified +// [cfe] 'Object' can't be used in both 'extends' and 'implements' clauses. abstract class D4 = C with T; // ^ // [analyzer] unspecified -// [cfe] unspecified +// [cfe] Can't use 'Object' as a mixin because it has constructors. main() { T.named(); // ^^^^^ // [analyzer] unspecified -// [cfe] unspecified +// [cfe] Method not found: 'Object.named'. T.staticMethod(); // ^^^^^^^^^^^^ // [analyzer] unspecified +// [cfe] A constructor invocation can't have type arguments after the constructor name. // [cfe] Method not found: 'Object.staticMethod'. -// ^^^^^^^^^^^^ -// [cfe] A constructor invocation can't have type arguments on the constructor name. } diff --git a/tests/language/nonfunction_type_aliases/usage_object_error_test.dart b/tests/language/nonfunction_type_aliases/usage_object_error_test.dart index 8fad251401f..1046f6e9cba 100644 --- a/tests/language/nonfunction_type_aliases/usage_object_error_test.dart +++ b/tests/language/nonfunction_type_aliases/usage_object_error_test.dart @@ -25,28 +25,27 @@ class C1 implements C { abstract class D2 extends C with T {} // ^ // [analyzer] unspecified -// [cfe] unspecified +// [cfe] Can't use 'Object' as a mixin because it has constructors. abstract class D3 implements T {} // ^ // [analyzer] unspecified -// [cfe] unspecified +// [cfe] 'Object' can't be used in both 'extends' and 'implements' clauses. abstract class D4 = C with T; // ^ // [analyzer] unspecified -// [cfe] unspecified +// [cfe] Can't use 'Object' as a mixin because it has constructors. main() { T.named(); // ^^^^^ // [analyzer] unspecified -// [cfe] unspecified +// [cfe] Method not found: 'Object.named'. T.staticMethod(); // ^^^^^^^^^^^^ // [analyzer] unspecified +// [cfe] A constructor invocation can't have type arguments after the constructor name. // [cfe] Method not found: 'Object.staticMethod'. -// ^^^^^^^^^^^^ -// [cfe] A constructor invocation can't have type arguments on the constructor name. } diff --git a/tests/language_2/constructor/named_constructor_test.dart b/tests/language_2/constructor/named_constructor_test.dart index c36fe2230b1..378c9b2f60d 100644 --- a/tests/language_2/constructor/named_constructor_test.dart +++ b/tests/language_2/constructor/named_constructor_test.dart @@ -24,7 +24,7 @@ void main() { // 'Class.named' is not a type: new Class.named().value; // ^ - // [cfe] A constructor invocation can't have type arguments on the constructor name. + // [cfe] A constructor invocation can't have type arguments after the constructor name. // ^^^^^ // [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR @@ -32,7 +32,7 @@ void main() { new Class.named().value; // ^^^^^ // [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR - // [cfe] A constructor invocation can't have type arguments on the constructor name. + // [cfe] A constructor invocation can't have type arguments after the constructor name. new prefix.Class().value; // 'prefix' is not a type: @@ -48,7 +48,7 @@ void main() { // [cfe] Method not found: 'prefix.Class'. // ^^^^^ // [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR - // [cfe] A constructor invocation can't have type arguments on the constructor name. + // [cfe] A constructor invocation can't have type arguments after the constructor name. new prefix.Class.named().value; // 'prefix.Class.named' doesn't fit the grammar syntax T.id: @@ -67,7 +67,7 @@ void main() { new prefix.Class.named().value; // ^^^^^ // [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR - // [cfe] A constructor invocation can't have type arguments on the constructor name. + // [cfe] A constructor invocation can't have type arguments after the constructor name. // 'prefix.Class' doesn't fit the grammar syntax T.id: new prefix.Class.named().value; @@ -76,7 +76,7 @@ void main() { // [cfe] Method not found: 'prefix.Class'. // ^^^^^ // [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR - // [cfe] A constructor invocation can't have type arguments on the constructor name. + // [cfe] A constructor invocation can't have type arguments after the constructor name. // 'prefix.Class.named' doesn't fit the grammar syntax T.id: @@ -93,7 +93,7 @@ void main() { new prefix.Class.named().value; // ^^^^^ // [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR - // [cfe] A constructor invocation can't have type arguments on the constructor name. + // [cfe] A constructor invocation can't have type arguments after the constructor name. // 'prefix.Class.named' doesn't fit the grammar syntax T.id: new prefix.Class.named().value; @@ -102,5 +102,5 @@ void main() { // [cfe] Method not found: 'prefix.Class'. // ^^^^^ // [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR - // [cfe] A constructor invocation can't have type arguments on the constructor name. + // [cfe] A constructor invocation can't have type arguments after the constructor name. } diff --git a/tests/language_2/constructor/reference_test.dart b/tests/language_2/constructor/reference_test.dart index 03d4c5609ce..ec284ab16eb 100644 --- a/tests/language_2/constructor/reference_test.dart +++ b/tests/language_2/constructor/reference_test.dart @@ -29,14 +29,14 @@ main() { // [cfe] The method 'baz' isn't defined for the class 'Foo'. new Foo.bar(); // ^ - // [cfe] A constructor invocation can't have type arguments on the constructor name. + // [cfe] A constructor invocation can't have type arguments after the constructor name. // ^^^^^ // [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR new Foo.bar.baz(); - // ^ - // [cfe] A constructor invocation can't have type arguments on the constructor name. // ^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.CREATION_WITH_NON_TYPE + // ^ + // [cfe] A constructor invocation can't have type arguments after the constructor name. // ^ // [cfe] Method not found: 'Foo.bar.baz'. new Foo.bar.baz(); @@ -44,8 +44,7 @@ main() { // [analyzer] COMPILE_TIME_ERROR.CREATION_WITH_NON_TYPE // ^^^ // [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR - // [cfe] A constructor invocation can't have type arguments on the constructor name. - // ^ + // [cfe] A constructor invocation can't have type arguments after the constructor name. // [cfe] Method not found: 'Foo.bar.baz'. const Foo(); @@ -66,14 +65,14 @@ main() { // [cfe] The method 'baz' isn't defined for the class 'Foo'. const Foo.bar(); // ^ - // [cfe] A constructor invocation can't have type arguments on the constructor name. + // [cfe] A constructor invocation can't have type arguments after the constructor name. // ^^^^^ // [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR const Foo.bar.baz(); - // ^ - // [cfe] A constructor invocation can't have type arguments on the constructor name. // ^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.CREATION_WITH_NON_TYPE + // ^ + // [cfe] A constructor invocation can't have type arguments after the constructor name. // ^ // [cfe] Method not found: 'Foo.bar.baz'. const Foo.bar.baz(); @@ -81,42 +80,41 @@ main() { // [analyzer] COMPILE_TIME_ERROR.CREATION_WITH_NON_TYPE // ^^^ // [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR - // [cfe] A constructor invocation can't have type arguments on the constructor name. - // ^ + // [cfe] A constructor invocation can't have type arguments after the constructor name. // [cfe] Method not found: 'Foo.bar.baz'. Foo(); Foo.bar(); Foo.bar.baz(); - // ^^^ - // [cfe] Getter not found: 'bar'. - // ^^^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD +// ^ +// [cfe] Getter not found: 'bar'. +// ^^^ +// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD Foo(); Foo.bar(); Foo.bar.baz(); // ^^^^^ // [analyzer] SYNTACTIC_ERROR.EXPERIMENT_NOT_ENABLED // [cfe] This requires the 'constructor-tearoffs' language feature to be enabled. - // ^^^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD // ^ // [cfe] Getter not found: 'bar'. + // ^^^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD Foo.bar(); // ^ - // [cfe] A constructor invocation can't have type arguments on the constructor name. + // [cfe] A constructor invocation can't have type arguments after the constructor name. // ^^^^^ // [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR Foo.bar.baz(); - // ^ - // [cfe] A constructor invocation can't have type arguments on the constructor name. //^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.CREATION_WITH_NON_TYPE - // ^ - // [cfe] Method not found: 'Foo.bar.baz'. +// ^ +// [cfe] A constructor invocation can't have type arguments after the constructor name. +// ^ +// [cfe] Method not found: 'Foo.bar.baz'. Foo.bar.baz(); - // ^^^ - // [cfe] Getter not found: 'bar'. - // ^^^ - // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD +// ^ +// [cfe] Getter not found: 'bar'. +// ^^^ +// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD }