diff --git a/tests/language/enum/duplicate_lib.dart b/tests/language/enum/duplicate_lib.dart index b9c84f5109a..a7e76b42d27 100644 --- a/tests/language/enum/duplicate_lib.dart +++ b/tests/language/enum/duplicate_lib.dart @@ -4,10 +4,7 @@ library enum_duplicate_lib; -enum Enum1 { - A, - B, -} +enum Enum1 { A, B } class Enum2 { static Iterable get values => ['Enum2.A', 'Enum2.B']; diff --git a/tests/language/enum/enhanced_enums_basic_test.dart b/tests/language/enum/enhanced_enums_basic_test.dart index 43deaef29b7..961c1d5c63f 100644 --- a/tests/language/enum/enhanced_enums_basic_test.dart +++ b/tests/language/enum/enhanced_enums_basic_test.dart @@ -29,12 +29,18 @@ void main() { Expect.identical(EnumPlainSemicolon.v3, EnumPlainSemicolon.values[2]); Expect.equals(3, EnumPlainTrailingCommaSemicolon.values.length); - Expect.identical(EnumPlainTrailingCommaSemicolon.v1, - EnumPlainTrailingCommaSemicolon.values[0]); - Expect.identical(EnumPlainTrailingCommaSemicolon.v2, - EnumPlainTrailingCommaSemicolon.values[1]); - Expect.identical(EnumPlainTrailingCommaSemicolon.v3, - EnumPlainTrailingCommaSemicolon.values[2]); + Expect.identical( + EnumPlainTrailingCommaSemicolon.v1, + EnumPlainTrailingCommaSemicolon.values[0], + ); + Expect.identical( + EnumPlainTrailingCommaSemicolon.v2, + EnumPlainTrailingCommaSemicolon.values[1], + ); + Expect.identical( + EnumPlainTrailingCommaSemicolon.v3, + EnumPlainTrailingCommaSemicolon.values[2], + ); Expect.equals(6, EnumAll.values.length); Expect.identical(EnumAll.v1, EnumAll.values[0]); @@ -105,7 +111,9 @@ void main() { Expect.identical(EnumAll.v4, EnumAll.v3 ^ EnumAll.v2); Expect.equals( - "EnumAll.v1:EnumMixin:ObjectMixin:this", EnumAll.v1.thisAndSuper()); + "EnumAll.v1:EnumMixin:ObjectMixin:this", + EnumAll.v1.thisAndSuper(), + ); // Which can reference type parameters. Expect.isTrue(EnumAll.v2.test(2)); // does `is T` with `T` being `int`. @@ -148,35 +156,22 @@ void main() { enum EnumPlain { v1, v2, v3 } // Also with trailing comma. -enum EnumPlainTrailingComma { - v1, - v2, - v3, -} +enum EnumPlainTrailingComma { v1, v2, v3 } // Also if using type parameters, mixins or interfaces. // It only matters whether there is something after the values. enum EnumNoSemicolon with ObjectMixin implements Interface { v1, v2, - v3 + v3, } // Allows semicolon after values, even when not needed. // Without trailing comma. -enum EnumPlainSemicolon { - v1, - v2, - v3; -} +enum EnumPlainSemicolon { v1, v2, v3 } // With trailing comma. -enum EnumPlainTrailingCommaSemicolon { - v1, - v2, - v3, - ; -} +enum EnumPlainTrailingCommaSemicolon { v1, v2, v3 } // Full syntax, with every possible option. @EnumAll.v1 @@ -193,8 +188,7 @@ enum EnumAll v3(y: 2), v4.named(1, y: 2), v5.renamed(1, y: 2), - v6.new(), - ; + v6.new(); /// Static members. /// @@ -216,16 +210,16 @@ enum EnumAll // Constructors. // Generative, non-redirecting, unnamed. const EnumAll({T? y}) - : constructor = "unnamed", - this.x = 0 as S, - y = y ?? (0 as T); + : constructor = "unnamed", + this.x = 0 as S, + y = y ?? (0 as T); // Generative, non-redirecting, named. const EnumAll.named(this.x, {T? y, String? constructor}) - : constructor = constructor ?? "named", - y = y ?? (0 as T); + : constructor = constructor ?? "named", + y = y ?? (0 as T); // Generative, redirecting. const EnumAll.renamed(S x, {T? y}) - : this.named(x, y: y, constructor: "renamed"); + : this.named(x, y: y, constructor: "renamed"); // Factory, non-redirecting. factory EnumAll.factory(int index) => values[index] as EnumAll; // Factory, redirecting (only to other factory constructor). diff --git a/tests/language/enum/enhanced_enums_error_test.dart b/tests/language/enum/enhanced_enums_error_test.dart index ccdcfa0a3cf..795996c7767 100644 --- a/tests/language/enum/enhanced_enums_error_test.dart +++ b/tests/language/enum/enhanced_enums_error_test.dart @@ -264,7 +264,7 @@ enum ConflictClassTypeParameter { // [analyzer] COMPILE_TIME_ERROR.CONFLICTING_TYPE_VARIABLE_AND_CONTAINER // [cfe] A type variable can't have the same name as its enclosing declaration. e1; - //^ + // [error column 3] // [cfe] Couldn't find constructor 'ConflictClassTypeParameter'. } @@ -405,10 +405,10 @@ enum ConflictClassEnumValue { // Has conflict with implicitly inserted `values` member. enum values { // ^^^^^^ - // [analyzer] unspecified + // [analyzer] COMPILE_TIME_ERROR.ENUM_WITH_NAME_VALUES // [cfe] The name 'values' is not a valid name for an enum. Try using a different name. e1; - //^ + // [error column 3] // [cfe] Couldn't find constructor 'values'. } @@ -449,9 +449,8 @@ enum OverridesEquals { e1; bool operator==(Object other) => identical(e1, other); - // ^^^^^^^^ - // [analyzer] unspecified - // ^ + // ^^ + // [analyzer] COMPILE_TIME_ERROR.ILLEGAL_CONCRETE_ENUM_MEMBER // [cfe] An enum can't declare a non-abstract member named '=='. } @@ -460,7 +459,7 @@ enum OverridesHashCode { int get hashCode => 42; // ^^^^^^^^ - // [analyzer] unspecified + // [analyzer] COMPILE_TIME_ERROR.ILLEGAL_CONCRETE_ENUM_MEMBER // [cfe] An enum can't declare a non-abstract member named 'hashCode'. } @@ -515,9 +514,9 @@ enum NoConstructorCalls { // [cfe] Final field 'x' is not initialized by this constructor. // ^^^^^^^^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.REDIRECT_GENERATIVE_TO_NON_GENERATIVE_CONSTRUCTOR - // [cfe] Couldn't find constructor 'NoConstructorCalls.factory'. // ^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.REDIRECT_TO_NON_CONST_CONSTRUCTOR + // [cfe] Couldn't find constructor 'NoConstructorCalls.factory'. factory NoConstructorCalls.factory() => e1; // Valid. @@ -614,7 +613,7 @@ enum DeclaresStaticIndex { enum InheritsIndex with IndexGetter { // ^^^^^^^^^^^^^ - // [analyzer] unspecified + // [analyzer] COMPILE_TIME_ERROR.ILLEGAL_CONCRETE_ENUM_MEMBER // [cfe] An enum can't inherit a member named 'index'. e1; } @@ -643,8 +642,8 @@ enum ImplementsNeverIndex { } enum NSMImplementsNeverIndex implements NeverIndexGetter { - // ^^^^^^ - // [analyzer] unspecified + // ^^^^^^^^^^^^^^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.INVALID_IMPLEMENTATION_OVERRIDE // [cfe] The implementation of 'index' in the non-abstract class 'NSMImplementsNeverIndex' does not conform to its interface. e1; @@ -670,11 +669,10 @@ enum CyclicReference { // Since `values` contains `e1`, // we can't have a reference in the other direction. enum CyclicReferenceValues { -// ^ -// [cfe] Constant evaluation error: e1(values); //^^ // [analyzer] COMPILE_TIME_ERROR.RECURSIVE_COMPILE_TIME_CONSTANT +// [cfe] Constant evaluation error: final List list; const CyclicReferenceValues(this.list); } diff --git a/tests/language/enum/enhanced_enums_subtype_error_test.dart b/tests/language/enum/enhanced_enums_subtype_error_test.dart index 0c351deab55..198fa784fa1 100644 --- a/tests/language/enum/enhanced_enums_subtype_error_test.dart +++ b/tests/language/enum/enhanced_enums_subtype_error_test.dart @@ -35,8 +35,8 @@ abstract class AbstractImplementsWithValues implements Enum { } abstract class AbstractExtendsWithValues extends Enum { -// ^ -// [cfe] The class 'Enum' can't be extended outside of its library because it's an interface class. + // ^ + // [cfe] The class 'Enum' can't be extended outside of its library because it's an interface class. int get values => 42; // ^^^^^^ // [analyzer] COMPILE_TIME_ERROR.ILLEGAL_ENUM_VALUES @@ -51,8 +51,8 @@ abstract class AbstractImplementsWithIndex implements Enum { } abstract class AbstractExtendsWithIndex extends Enum { -// ^ -// [cfe] The class 'Enum' can't be extended outside of its library because it's an interface class. + // ^ + // [cfe] The class 'Enum' can't be extended outside of its library because it's an interface class. int get index => 42; // ^^^^^ // [analyzer] COMPILE_TIME_ERROR.ILLEGAL_CONCRETE_ENUM_MEMBER @@ -184,7 +184,7 @@ enum EnumImplementsEnum implements MyEnum { // [cfe] 'MyEnum' is an enum and can't be extended or implemented. // ^^^^^^ // [analyzer] COMPILE_TIME_ERROR.IMPLEMENTS_NON_CLASS - e1; + e1, } enum EnumMixesInEnum with MyEnum { @@ -195,11 +195,9 @@ enum EnumMixesInEnum with MyEnum { // [analyzer] COMPILE_TIME_ERROR.MIXIN_OF_NON_CLASS // [cfe] The class 'MyEnum' can't be used as a mixin because it extends a class other than 'Object'. // [cfe] The class 'MyEnum' can't be used as a mixin because it isn't a mixin class nor a mixin. - e1; + e1, } void main() {} -enum MyEnum { - e1; -} +enum MyEnum { e1 } diff --git a/tests/language/enum/enum_test.dart b/tests/language/enum/enum_test.dart index 5a52743f9ba..b010288e9bb 100644 --- a/tests/language/enum/enum_test.dart +++ b/tests/language/enum/enum_test.dart @@ -10,10 +10,10 @@ enum Enum2 { A } enum Enum3 { B, C } -enum Enum4 { - D, - E, -} +// Don't format to preserve the trailing comma. +// dart format off +enum Enum4 { D, E, } +// dart format on enum Enum5 { F, G, H } @@ -35,7 +35,7 @@ enum JSFunctionPrototype { constructor, apply, bind, - call + call, } void expectIs(T t, bool Function(Object?) test) { diff --git a/tests/language/enum/index_test.dart b/tests/language/enum/index_test.dart index ce6994b4476..b013a16bae6 100644 --- a/tests/language/enum/index_test.dart +++ b/tests/language/enum/index_test.dart @@ -8,10 +8,7 @@ library enum_index_test; import 'package:expect/expect.dart'; -enum Enum { - A, - B, -} +enum Enum { A, B } class Class { var index; diff --git a/tests/language/enum/initialization_near_stack_overflow_test.dart b/tests/language/enum/initialization_near_stack_overflow_test.dart index 598b382c070..c145af0c9a3 100644 --- a/tests/language/enum/initialization_near_stack_overflow_test.dart +++ b/tests/language/enum/initialization_near_stack_overflow_test.dart @@ -9,10 +9,7 @@ // how much stack is left and used by the compiler. It should never crash nor // produce a runtime exception. -enum Fruit { - apple, - banana, -} +enum Fruit { apple, banana } getFruit() => Fruit.apple; diff --git a/tests/language/enum/private_lib.dart b/tests/language/enum/private_lib.dart index c8fb00f6f3f..0cbe5c85cc7 100644 --- a/tests/language/enum/private_lib.dart +++ b/tests/language/enum/private_lib.dart @@ -4,7 +4,4 @@ library enum_private_lib; -enum Enum2 { - _A, - _B, -} +enum Enum2 { _A, _B } diff --git a/tests/language/enum/private_runtime_1_test.dart b/tests/language/enum/private_runtime_1_test.dart index 27b4b74c7ad..a71252235ff 100644 --- a/tests/language/enum/private_runtime_1_test.dart +++ b/tests/language/enum/private_runtime_1_test.dart @@ -13,10 +13,7 @@ import 'package:expect/expect.dart'; import 'private_lib.dart'; -enum Enum1 { - _A, - _B, -} +enum Enum1 { _A, _B } main() { Expect.equals('Enum1._A,Enum1._B', Enum1.values.join(',')); diff --git a/tests/language/enum/private_runtime_test.dart b/tests/language/enum/private_runtime_test.dart index e479dfd7255..459b1d14b0a 100644 --- a/tests/language/enum/private_runtime_test.dart +++ b/tests/language/enum/private_runtime_test.dart @@ -13,10 +13,7 @@ import 'package:expect/expect.dart'; import 'private_lib.dart'; -enum Enum1 { - _A, - _B, -} +enum Enum1 { _A, _B } main() { Expect.equals('Enum1._A,Enum1._B', Enum1.values.join(',')); diff --git a/tests/language/enum/private_test.dart b/tests/language/enum/private_test.dart index 7a8dfa32bb1..4bfc37f785f 100644 --- a/tests/language/enum/private_test.dart +++ b/tests/language/enum/private_test.dart @@ -10,10 +10,7 @@ import 'package:expect/expect.dart'; import 'private_lib.dart'; -enum Enum1 { - _A, - _B, -} +enum Enum1 { _A, _B } main() { Expect.equals('Enum1._A,Enum1._B', Enum1.values.join(',')); diff --git a/tests/language/exception/on_catch_malformed_type_test.dart b/tests/language/exception/on_catch_malformed_type_test.dart index 435d1752431..7430461ac6a 100644 --- a/tests/language/exception/on_catch_malformed_type_test.dart +++ b/tests/language/exception/on_catch_malformed_type_test.dart @@ -14,9 +14,9 @@ catchUnresolvedBefore() { } on String catch (oks) { // This is tested before the catch block below. } on Unavailable catch (ex) { - // ^^^^^^^^^^^ - // [analyzer] COMPILE_TIME_ERROR.NON_TYPE_IN_CATCH_CLAUSE - // [cfe] 'Unavailable' isn't a type. + // ^^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.NON_TYPE_IN_CATCH_CLAUSE + // [cfe] 'Unavailable' isn't a type. Expect.fail("This code shouldn't be executed"); } } @@ -27,9 +27,9 @@ catchUnresolvedAfter() { throw "foo"; Expect.fail("This code shouldn't be executed"); } on Unavailable catch (ex) { - // ^^^^^^^^^^^ - // [analyzer] COMPILE_TIME_ERROR.NON_TYPE_IN_CATCH_CLAUSE - // [cfe] 'Unavailable' isn't a type. + // ^^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.NON_TYPE_IN_CATCH_CLAUSE + // [cfe] 'Unavailable' isn't a type. // This is tested before the catch block below. // In both production and checked mode the test causes a type error. diff --git a/tests/language/exception/throw_expr_test.dart b/tests/language/exception/throw_expr_test.dart index c1f5044a308..7d4d2fb3b7c 100644 --- a/tests/language/exception/throw_expr_test.dart +++ b/tests/language/exception/throw_expr_test.dart @@ -41,9 +41,13 @@ void test2() { Expect.equals(15, x); } -foo(x, y) => throw "foo" "$x"; +foo(x, y) => + throw "foo" + "$x"; -bar(x, y) => throw "foo" "${throw x}"; +bar(x, y) => + throw "foo" + "${throw x}"; class Q { var qqq; diff --git a/tests/language/exception/try_catch3_test.dart b/tests/language/exception/try_catch3_test.dart index c81e04d746e..3489793c007 100644 --- a/tests/language/exception/try_catch3_test.dart +++ b/tests/language/exception/try_catch3_test.dart @@ -22,7 +22,7 @@ class MyException implements TestException { class MyParameterizedException implements TestException { const MyParameterizedException([String message = ""]) - : this._message = message; + : this._message = message; String getMessage() { return _message; } diff --git a/tests/language/export/private_runtime_test.dart b/tests/language/export/private_runtime_test.dart index e78b2b1b4c7..e2628a18f2d 100644 --- a/tests/language/export/private_runtime_test.dart +++ b/tests/language/export/private_runtime_test.dart @@ -6,8 +6,6 @@ // BSD-style license that can be found in the LICENSE file. // Check that private dart:_ libraries cannot be imported. - - main() { print("Done."); } diff --git a/tests/language/export/private_test.dart b/tests/language/export/private_test.dart index d152f327e75..f6d5489a67b 100644 --- a/tests/language/export/private_test.dart +++ b/tests/language/export/private_test.dart @@ -4,7 +4,7 @@ // Check that private dart:_ libraries cannot be imported. export "dart:_internal"; -// [error line 6, column 1, length 24] +// [error column 1, length 24] // [analyzer] COMPILE_TIME_ERROR.EXPORT_INTERNAL_LIBRARY // [cfe] Can't access platform private library. diff --git a/tests/language/extension_methods/issue_45551_error_test.dart b/tests/language/extension_methods/issue_45551_error_test.dart index 524b4f6fd75..a2289dd60f1 100644 --- a/tests/language/extension_methods/issue_45551_error_test.dart +++ b/tests/language/extension_methods/issue_45551_error_test.dart @@ -13,10 +13,10 @@ extension on C { test(C c) { c(); -//^ -// [analyzer] COMPILE_TIME_ERROR.INVOCATION_OF_NON_FUNCTION_EXPRESSION -// ^ -// [cfe] Cannot invoke an instance of 'C' because it declares 'call' to be something other than a method. + // [error column 3, length 1] + // [analyzer] COMPILE_TIME_ERROR.INVOCATION_OF_NON_FUNCTION_EXPRESSION + // [error column 4, length 1] + // [cfe] Cannot invoke an instance of 'C' because it declares 'call' to be something other than a method. } main() {} diff --git a/tests/language/extension_methods/static_extension_bounds_error_test.dart b/tests/language/extension_methods/static_extension_bounds_error_test.dart index 9ad1a9ac6d0..e7f8a38fbb1 100644 --- a/tests/language/extension_methods/static_extension_bounds_error_test.dart +++ b/tests/language/extension_methods/static_extension_bounds_error_test.dart @@ -31,18 +31,18 @@ void main() { // Inferred type of String does not satisfy the bound. s.e1; -// ^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER -// [cfe] The getter 'e1' isn't defined for the class 'String'. + //^^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'e1' isn't defined for the class 'String'. E1(s).e1; -// ^ -// [analyzer] COMPILE_TIME_ERROR.EXTENSION_OVERRIDE_ARGUMENT_NOT_ASSIGNABLE -// [cfe] The argument type 'String' can't be assigned to the parameter type 'num'. + // ^ + // [analyzer] COMPILE_TIME_ERROR.EXTENSION_OVERRIDE_ARGUMENT_NOT_ASSIGNABLE + // [cfe] The argument type 'String' can't be assigned to the parameter type 'num'. E1(s).e1; -//^ -// [cfe] Type argument 'String' doesn't conform to the bound 'num' of the type variable 'T' on 'E1|get#e1'. -// ^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS + // [error column 3] + // [cfe] Type argument 'String' doesn't conform to the bound 'num' of the type variable 'T' on 'E1|get#e1'. + // ^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS // Inferred types of int and double are ok i.e1; @@ -54,18 +54,18 @@ void main() { // Inferred type of String does not satisfy the bound. s.e2; -// ^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER -// [cfe] The getter 'e2' isn't defined for the class 'String'. + //^^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'e2' isn't defined for the class 'String'. E2(s).e2; -//^^ -// [analyzer] COMPILE_TIME_ERROR.COULD_NOT_INFER -// [cfe] Inferred type argument 'String' doesn't conform to the bound 'S' of the type variable 'T' on 'E2|get#e2'. + // [error column 3, length 2] + // [analyzer] COMPILE_TIME_ERROR.COULD_NOT_INFER + // [cfe] Inferred type argument 'String' doesn't conform to the bound 'S' of the type variable 'T' on 'E2|get#e2'. E2(s).e2; -//^ -// [cfe] Type argument 'String' doesn't conform to the bound 'S' of the type variable 'T' on 'E2|get#e2'. -// ^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS + // [error column 3] + // [cfe] Type argument 'String' doesn't conform to the bound 'S' of the type variable 'T' on 'E2|get#e2'. + // ^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS // Inferred types of int and double are ok i.e2; @@ -78,17 +78,17 @@ void main() { // Inferred type int for method type parameter doesn't match the inferred // bound of String s.f3(3); -// ^ -// [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE -// [cfe] The argument type 'int' can't be assigned to the parameter type 'String'. + // ^ + // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE + // [cfe] The argument type 'int' can't be assigned to the parameter type 'String'. E3(s).f3(3); -// ^ -// [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE -// [cfe] The argument type 'int' can't be assigned to the parameter type 'String'. + // ^ + // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE + // [cfe] The argument type 'int' can't be assigned to the parameter type 'String'. E3(s).f3(3); -// ^ -// [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE -// [cfe] The argument type 'int' can't be assigned to the parameter type 'String'. + // ^ + // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE + // [cfe] The argument type 'int' can't be assigned to the parameter type 'String'. // Inferred type int for method type parameter is ok i.f3(3); @@ -98,17 +98,17 @@ void main() { // Inferred type int for method type parameter doesn't match the inferred // bound of double d.f3(3); -// ^ -// [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE -// [cfe] The argument type 'int' can't be assigned to the parameter type 'double'. + // ^ + // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE + // [cfe] The argument type 'int' can't be assigned to the parameter type 'double'. E3(d).f3(3); -// ^ -// [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE -// [cfe] The argument type 'int' can't be assigned to the parameter type 'double'. + // ^ + // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE + // [cfe] The argument type 'int' can't be assigned to the parameter type 'double'. E3(d).f3(3); -// ^ -// [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE -// [cfe] The argument type 'int' can't be assigned to the parameter type 'double'. + // ^ + // [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE + // [cfe] The argument type 'int' can't be assigned to the parameter type 'double'. RecSolution recs = RecSolution(); Rec superRec = RecSolution(); // Super-bounded type. @@ -120,16 +120,16 @@ void main() { // Inferred super-bounded type is invalid as type argument superRec.e4; -// ^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER -// [cfe] The getter 'e4' isn't defined for the class 'Rec'. + // ^^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER + // [cfe] The getter 'e4' isn't defined for the class 'Rec'. E4(superRec).e4; -//^^ -// [analyzer] COMPILE_TIME_ERROR.COULD_NOT_INFER -// [cfe] Inferred type argument 'Rec' doesn't conform to the bound 'Rec' of the type variable 'T' on 'E4|get#e4'. + // [error column 3, length 2] + // [analyzer] COMPILE_TIME_ERROR.COULD_NOT_INFER + // [cfe] Inferred type argument 'Rec' doesn't conform to the bound 'Rec' of the type variable 'T' on 'E4|get#e4'. E4>(superRec).e4; -//^ -// [cfe] Type argument 'Rec' doesn't conform to the bound 'Rec' of the type variable 'T' on 'E4|get#e4'. -// ^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS + // [error column 3] + // [cfe] Type argument 'Rec' doesn't conform to the bound 'Rec' of the type variable 'T' on 'E4|get#e4'. + // ^^^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS } diff --git a/tests/language/extension_methods/static_extension_constant_error_test.dart b/tests/language/extension_methods/static_extension_constant_error_test.dart index a1bca72c4b3..91b630476e9 100644 --- a/tests/language/extension_methods/static_extension_constant_error_test.dart +++ b/tests/language/extension_methods/static_extension_constant_error_test.dart @@ -15,74 +15,90 @@ void main() { const c01 = ~i; // ^^ - // [analyzer] unspecified - // [cfe] unspecified + // [analyzer] COMPILE_TIME_ERROR.CONST_EVAL_EXTENSION_METHOD + // [cfe] Constant evaluation error: const c02 = b & b; // ^^^^^ - // [analyzer] unspecified - // [cfe] unspecified + // [analyzer] COMPILE_TIME_ERROR.CONST_EVAL_EXTENSION_METHOD + // ^ + // [cfe] Constant evaluation error: const c03 = b | b; // ^^^^^ - // [analyzer] unspecified - // [cfe] unspecified + // [analyzer] COMPILE_TIME_ERROR.CONST_EVAL_EXTENSION_METHOD + // ^ + // [cfe] Constant evaluation error: const c04 = b ^ b; // ^^^^^ - // [analyzer] unspecified - // [cfe] unspecified + // [analyzer] COMPILE_TIME_ERROR.CONST_EVAL_EXTENSION_METHOD + // ^ + // [cfe] Constant evaluation error: const c05 = i ~/ i; // ^^^^^^ - // [analyzer] unspecified - // [cfe] unspecified + // [analyzer] COMPILE_TIME_ERROR.CONST_EVAL_EXTENSION_METHOD + // ^ + // [cfe] Constant evaluation error: const c06 = i >> i; // ^^^^^^ - // [analyzer] unspecified - // [cfe] unspecified + // [analyzer] COMPILE_TIME_ERROR.CONST_EVAL_EXTENSION_METHOD + // ^ + // [cfe] Constant evaluation error: const c08 = i << i; // ^^^^^^ - // [analyzer] unspecified - // [cfe] unspecified + // [analyzer] COMPILE_TIME_ERROR.CONST_EVAL_EXTENSION_METHOD + // ^ + // [cfe] Constant evaluation error: const c09 = i + i; // ^^^^^ - // [analyzer] unspecified - // [cfe] unspecified + // [analyzer] COMPILE_TIME_ERROR.CONST_EVAL_EXTENSION_METHOD + // ^ + // [cfe] Constant evaluation error: const c10 = -i; // ^^ - // [analyzer] unspecified - // [cfe] unspecified + // [analyzer] COMPILE_TIME_ERROR.CONST_EVAL_EXTENSION_METHOD + // [cfe] Constant evaluation error: const c11 = d - d; // ^^^^^ - // [analyzer] unspecified - // [cfe] unspecified + // [analyzer] COMPILE_TIME_ERROR.CONST_EVAL_EXTENSION_METHOD + // ^ + // [cfe] Constant evaluation error: const c12 = d * d; // ^^^^^ - // [analyzer] unspecified - // [cfe] unspecified + // [analyzer] COMPILE_TIME_ERROR.CONST_EVAL_EXTENSION_METHOD + // ^ + // [cfe] Constant evaluation error: const c13 = d / d; // ^^^^^ - // [analyzer] unspecified - // [cfe] unspecified + // [analyzer] COMPILE_TIME_ERROR.CONST_EVAL_EXTENSION_METHOD + // ^ + // [cfe] Constant evaluation error: const c14 = d % d; // ^^^^^ - // [analyzer] unspecified - // [cfe] unspecified + // [analyzer] COMPILE_TIME_ERROR.CONST_EVAL_EXTENSION_METHOD + // ^ + // [cfe] Constant evaluation error: const c15 = d < i; // ^^^^^ - // [analyzer] unspecified - // [cfe] unspecified + // [analyzer] COMPILE_TIME_ERROR.CONST_EVAL_EXTENSION_METHOD + // ^ + // [cfe] Constant evaluation error: const c16 = i <= d; // ^^^^^^ - // [analyzer] unspecified - // [cfe] unspecified + // [analyzer] COMPILE_TIME_ERROR.CONST_EVAL_EXTENSION_METHOD + // ^ + // [cfe] Constant evaluation error: const c17 = d > i; // ^^^^^ - // [analyzer] unspecified - // [cfe] unspecified + // [analyzer] COMPILE_TIME_ERROR.CONST_EVAL_EXTENSION_METHOD + // ^ + // [cfe] Constant evaluation error: const c18 = i >= i; // ^^^^^^ - // [analyzer] unspecified - // [cfe] unspecified + // [analyzer] COMPILE_TIME_ERROR.CONST_EVAL_EXTENSION_METHOD + // ^ + // [cfe] Constant evaluation error: const c19 = s.length; // ^^^^^^^^ - // [analyzer] unspecified - // [cfe] unspecified + // [analyzer] COMPILE_TIME_ERROR.CONST_EVAL_EXTENSION_METHOD + // ^ + // [cfe] Constant evaluation error: } diff --git a/tests/language/extension_methods/static_extension_deferred_import_error_test.dart b/tests/language/extension_methods/static_extension_deferred_import_error_test.dart index 3d0c5ba4a2d..757766f7209 100644 --- a/tests/language/extension_methods/static_extension_deferred_import_error_test.dart +++ b/tests/language/extension_methods/static_extension_deferred_import_error_test.dart @@ -7,7 +7,7 @@ import "package:expect/expect.dart"; // It is an error to import a deferred library containing extensions without // hiding them. import "helpers/on_object.dart" deferred as p1; -// [error line 9, column 1] +// [error column 1] // [cfe] Extension 'OnObject' cannot be imported through a deferred import. // ^^^^^^^^^^^^^^^^^^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.DEFERRED_IMPORT_OF_EXTENSION diff --git a/tests/language/extension_methods/static_extension_deferred_import_resolution_error_test.dart b/tests/language/extension_methods/static_extension_deferred_import_resolution_error_test.dart index 8dc19f1bcd1..8594b623d00 100644 --- a/tests/language/extension_methods/static_extension_deferred_import_resolution_error_test.dart +++ b/tests/language/extension_methods/static_extension_deferred_import_resolution_error_test.dart @@ -9,9 +9,9 @@ import "helpers/on_object.dart" deferred as p1 hide OnObject; void main() { Object o = 1; OnObject(o).onObject; -//^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_FUNCTION -// [cfe] Method not found: 'OnObject'. + // [error column 3, length 8] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_FUNCTION + // [cfe] Method not found: 'OnObject'. o.onObject; //^^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER diff --git a/tests/language/extension_methods/static_extension_getter_setter_conflicts_test.dart b/tests/language/extension_methods/static_extension_getter_setter_conflicts_test.dart index db533d6bc24..2d89dd0f334 100644 --- a/tests/language/extension_methods/static_extension_getter_setter_conflicts_test.dart +++ b/tests/language/extension_methods/static_extension_getter_setter_conflicts_test.dart @@ -164,30 +164,30 @@ void test1() { // [cfe] The property 'm2' is defined in multiple extensions for 'C1' and neither is more specific. c1b[0]; -//^^^ -// [analyzer] COMPILE_TIME_ERROR.AMBIGUOUS_EXTENSION_MEMBER_ACCESS -// ^ -// [cfe] The operator '[]' is defined in multiple extensions for 'C1' and neither is more specific. + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.AMBIGUOUS_EXTENSION_MEMBER_ACCESS + // ^ + // [cfe] The operator '[]' is defined in multiple extensions for 'C1' and neither is more specific. c1b[0] = 0; -//^^^ -// [analyzer] COMPILE_TIME_ERROR.AMBIGUOUS_EXTENSION_MEMBER_ACCESS -// ^ -// [cfe] The operator '[]=' is defined in multiple extensions for 'C1' and neither is more specific. + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.AMBIGUOUS_EXTENSION_MEMBER_ACCESS + // ^ + // [cfe] The operator '[]=' is defined in multiple extensions for 'C1' and neither is more specific. c1b[0] += 0; -//^^^ -// [analyzer] COMPILE_TIME_ERROR.AMBIGUOUS_EXTENSION_MEMBER_ACCESS -// ^ -// [cfe] The operator '[]' is defined in multiple extensions for 'C1' and neither is more specific. -// [cfe] The operator '[]=' is defined in multiple extensions for 'C1' and neither is more specific. + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.AMBIGUOUS_EXTENSION_MEMBER_ACCESS + // ^ + // [cfe] The operator '[]' is defined in multiple extensions for 'C1' and neither is more specific. + // [cfe] The operator '[]=' is defined in multiple extensions for 'C1' and neither is more specific. c1b[0]++; -//^^^ -// [analyzer] COMPILE_TIME_ERROR.AMBIGUOUS_EXTENSION_MEMBER_ACCESS -// ^ -// [cfe] The operator '[]' is defined in multiple extensions for 'C1' and neither is more specific. -// [cfe] The operator '[]=' is defined in multiple extensions for 'C1' and neither is more specific. + // [error column 3, length 3] + // [analyzer] COMPILE_TIME_ERROR.AMBIGUOUS_EXTENSION_MEMBER_ACCESS + // ^ + // [cfe] The operator '[]' is defined in multiple extensions for 'C1' and neither is more specific. + // [cfe] The operator '[]=' is defined in multiple extensions for 'C1' and neither is more specific. C1 c1c = C1(); // E1A is more specific. diff --git a/tests/language/extension_methods/static_extension_getter_setter_test.dart b/tests/language/extension_methods/static_extension_getter_setter_test.dart index 25a3f1a8a35..7613d634da2 100644 --- a/tests/language/extension_methods/static_extension_getter_setter_test.dart +++ b/tests/language/extension_methods/static_extension_getter_setter_test.dart @@ -47,11 +47,12 @@ main() { // Cascades work. expectSet( - "E1.v4=E1.v4+[C.v1=C.v1-[C.v3=a]]", - c - ..v3 = Result("a") - ..v1 -= Result("[$lastSetter]") - ..v4 += Result("[$lastSetter]")); + "E1.v4=E1.v4+[C.v1=C.v1-[C.v3=a]]", + c + ..v3 = Result("a") + ..v1 -= Result("[$lastSetter]") + ..v4 += Result("[$lastSetter]"), + ); } /// Expect the value of [result] to be the [expected] string diff --git a/tests/language/extension_methods/static_extension_internal_basename_shadowing_error_test.dart b/tests/language/extension_methods/static_extension_internal_basename_shadowing_error_test.dart index bdb153587e0..b2b8347cd90 100644 --- a/tests/language/extension_methods/static_extension_internal_basename_shadowing_error_test.dart +++ b/tests/language/extension_methods/static_extension_internal_basename_shadowing_error_test.dart @@ -22,38 +22,38 @@ extension E1 on A1 { void test() { // The instance getter shadows the global setter topLevelSetter = topLevelSetter + 1; -// ^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER -// [cfe] Setter not found: 'topLevelSetter'. + // [error column 5, length 14] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER + // [cfe] Setter not found: 'topLevelSetter'. topLevelSetter++; -// ^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER -// [cfe] Setter not found: 'topLevelSetter'. + // [error column 5, length 14] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER + // [cfe] Setter not found: 'topLevelSetter'. topLevelSetter = 0; -// ^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER -// [cfe] Setter not found: 'topLevelSetter'. + // [error column 5, length 14] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER + // [cfe] Setter not found: 'topLevelSetter'. // The instance getter shadows the global field setter topLevelField = topLevelField + 1; -// ^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER -// [cfe] Setter not found: 'topLevelField'. + // [error column 5, length 13] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER + // [cfe] Setter not found: 'topLevelField'. topLevelField++; -// ^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER -// [cfe] Setter not found: 'topLevelField'. + // [error column 5, length 13] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER + // [cfe] Setter not found: 'topLevelField'. topLevelField = 0; -// ^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER -// [cfe] Setter not found: 'topLevelField'. + // [error column 5, length 13] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER + // [cfe] Setter not found: 'topLevelField'. // The instance getter shadows the global method topLevelMethod(4); -// ^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVOCATION_OF_NON_FUNCTION_EXPRESSION -// ^ -// [cfe] The method 'call' isn't defined for the class 'int'. + // [error column 5, length 14] + // [analyzer] COMPILE_TIME_ERROR.INVOCATION_OF_NON_FUNCTION_EXPRESSION + // ^ + // [cfe] The method 'call' isn't defined for the class 'int'. } } @@ -68,38 +68,38 @@ extension E2 on A2 { void test() { // The instance setter shadows the global getter topLevelGetter = topLevelGetter + 1; -// ^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER -// [cfe] Getter not found: 'topLevelGetter'. + // ^^^^^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] Getter not found: 'topLevelGetter'. topLevelGetter++; -// ^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER -// [cfe] Getter not found: 'topLevelGetter'. + // [error column 5, length 14] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] Getter not found: 'topLevelGetter'. topLevelGetter; -// ^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER -// [cfe] Getter not found: 'topLevelGetter'. + // [error column 5, length 14] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] Getter not found: 'topLevelGetter'. topLevelGetter = 3; // The instance setter shadows the global field getter topLevelField = topLevelField + 1; -// ^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER -// [cfe] Getter not found: 'topLevelField'. + // ^^^^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] Getter not found: 'topLevelField'. topLevelField++; -// ^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER -// [cfe] Getter not found: 'topLevelField'. + // [error column 5, length 13] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] Getter not found: 'topLevelField'. topLevelField; -// ^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER -// [cfe] Getter not found: 'topLevelField'. + // [error column 5, length 13] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] Getter not found: 'topLevelField'. // The instance setter shadows the global method topLevelMethod(4); -// ^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD -// [cfe] Getter not found: 'topLevelMethod'. + // [error column 5, length 14] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD + // [cfe] Getter not found: 'topLevelMethod'. } } @@ -114,38 +114,38 @@ extension E3 on A3 { void test() { // The static getter shadows the global setter topLevelSetter = topLevelSetter + 1; -// ^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER -// [cfe] Setter not found: 'topLevelSetter'. + // [error column 5, length 14] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER + // [cfe] Setter not found: 'topLevelSetter'. topLevelSetter++; -// ^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER -// [cfe] Setter not found: 'topLevelSetter'. + // [error column 5, length 14] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER + // [cfe] Setter not found: 'topLevelSetter'. topLevelSetter = 0; -// ^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER -// [cfe] Setter not found: 'topLevelSetter'. + // [error column 5, length 14] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER + // [cfe] Setter not found: 'topLevelSetter'. // The static getter shadows the global field setter topLevelField = topLevelField + 1; -// ^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER -// [cfe] Setter not found: 'topLevelField'. + // [error column 5, length 13] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER + // [cfe] Setter not found: 'topLevelField'. topLevelField++; -// ^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER -// [cfe] Setter not found: 'topLevelField'. + // [error column 5, length 13] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER + // [cfe] Setter not found: 'topLevelField'. topLevelField = 0; -// ^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER -// [cfe] Setter not found: 'topLevelField'. + // [error column 5, length 13] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER + // [cfe] Setter not found: 'topLevelField'. // The static getter shadows the global method topLevelMethod(4); -// ^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVOCATION_OF_NON_FUNCTION_EXPRESSION -// ^ -// [cfe] The method 'call' isn't defined for the class 'int'. + // [error column 5, length 14] + // [analyzer] COMPILE_TIME_ERROR.INVOCATION_OF_NON_FUNCTION_EXPRESSION + // ^ + // [cfe] The method 'call' isn't defined for the class 'int'. } } @@ -160,37 +160,37 @@ extension E4 on A4 { void test() { // The static setter shadows the global getter topLevelGetter = topLevelGetter + 1; -// ^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER -// [cfe] Getter not found: 'topLevelGetter'. + // ^^^^^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] Getter not found: 'topLevelGetter'. topLevelGetter++; -// ^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER -// [cfe] Getter not found: 'topLevelGetter'. + // [error column 5, length 14] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] Getter not found: 'topLevelGetter'. topLevelGetter; -// ^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER -// [cfe] Getter not found: 'topLevelGetter'. + // [error column 5, length 14] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] Getter not found: 'topLevelGetter'. // The static setter shadows the global field getter topLevelField = topLevelField + 1; -// ^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER -// [cfe] Getter not found: 'topLevelField'. + // ^^^^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] Getter not found: 'topLevelField'. topLevelField++; -// ^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER -// [cfe] Getter not found: 'topLevelField'. + // [error column 5, length 13] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] Getter not found: 'topLevelField'. topLevelField; -// ^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER -// [cfe] Getter not found: 'topLevelField'. + // [error column 5, length 13] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] Getter not found: 'topLevelField'. // The static setter shadows the global method topLevelMethod(4); -// ^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD -// [cfe] Getter not found: 'topLevelMethod'. + // [error column 5, length 14] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD + // [cfe] Getter not found: 'topLevelMethod'. } } @@ -210,24 +210,24 @@ extension E6 on A6 { void test() { // The instance getter shadows the other extension's setter extensionSetter = extensionSetter + 1; -// ^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER -// [cfe] Setter not found: 'extensionSetter'. + // [error column 5, length 15] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER + // [cfe] Setter not found: 'extensionSetter'. extensionSetter++; -// ^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER -// [cfe] Setter not found: 'extensionSetter'. + // [error column 5, length 15] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER + // [cfe] Setter not found: 'extensionSetter'. extensionSetter = 0; -// ^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER -// [cfe] Setter not found: 'extensionSetter'. + // [error column 5, length 15] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER + // [cfe] Setter not found: 'extensionSetter'. // The instance getter shadows the other extensions method extensionMethod(4); -// ^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVOCATION_OF_NON_FUNCTION_EXPRESSION -// ^ -// [cfe] The method 'call' isn't defined for the class 'int'. + // [error column 5, length 15] + // [analyzer] COMPILE_TIME_ERROR.INVOCATION_OF_NON_FUNCTION_EXPRESSION + // ^ + // [cfe] The method 'call' isn't defined for the class 'int'. } } @@ -241,24 +241,24 @@ class A7 extends A6 { void test() { // The instance getter shadows the other extension's setter extensionSetter = extensionSetter + 1; -// ^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER -// [cfe] The setter 'extensionSetter' isn't defined for the class 'A7'. + // [error column 5, length 15] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER + // [cfe] The setter 'extensionSetter' isn't defined for the class 'A7'. extensionSetter++; -// ^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER -// [cfe] The setter 'extensionSetter' isn't defined for the class 'A7'. + // [error column 5, length 15] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER + // [cfe] The setter 'extensionSetter' isn't defined for the class 'A7'. extensionSetter = 0; -// ^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER -// [cfe] The setter 'extensionSetter' isn't defined for the class 'A7'. + // [error column 5, length 15] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER + // [cfe] The setter 'extensionSetter' isn't defined for the class 'A7'. // The instance getter shadows the other extensions method extensionMethod(4); -// ^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVOCATION_OF_NON_FUNCTION_EXPRESSION -// ^ -// [cfe] 'extensionMethod' isn't a function or method and can't be invoked. + // [error column 5, length 15] + // [analyzer] COMPILE_TIME_ERROR.INVOCATION_OF_NON_FUNCTION_EXPRESSION + // ^ + // [cfe] 'extensionMethod' isn't a function or method and can't be invoked. } } @@ -276,23 +276,23 @@ extension E8 on A8 { void test() { // The instance setter shadows the other extension's getter extensionGetter = extensionGetter + 1; -// ^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER -// [cfe] Getter not found: 'extensionGetter'. + // ^^^^^^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] Getter not found: 'extensionGetter'. extensionGetter++; -// ^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER -// [cfe] Getter not found: 'extensionGetter'. + // [error column 5, length 15] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] Getter not found: 'extensionGetter'. extensionGetter; -// ^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER -// [cfe] Getter not found: 'extensionGetter'. + // [error column 5, length 15] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] Getter not found: 'extensionGetter'. // The instance setter shadows the other extension's method. extensionMethod(4); -// ^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD -// [cfe] Getter not found: 'extensionMethod'. + // [error column 5, length 15] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD + // [cfe] Getter not found: 'extensionMethod'. } } @@ -306,23 +306,23 @@ class A9 extends A8 { void test() { // The instance setter shadows the other extension's getter extensionGetter = extensionGetter + 1; -// ^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER -// [cfe] The getter 'extensionGetter' isn't defined for the class 'A9'. + // ^^^^^^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] The getter 'extensionGetter' isn't defined for the class 'A9'. extensionGetter++; -// ^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER -// [cfe] The getter 'extensionGetter' isn't defined for the class 'A9'. + // [error column 5, length 15] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] The getter 'extensionGetter' isn't defined for the class 'A9'. extensionGetter; -// ^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER -// [cfe] The getter 'extensionGetter' isn't defined for the class 'A9'. + // [error column 5, length 15] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] The getter 'extensionGetter' isn't defined for the class 'A9'. // The instance setter shadows the other extension's method. extensionMethod(4); -// ^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD -// [cfe] The method 'extensionMethod' isn't defined for the class 'A9'. + // [error column 5, length 15] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD + // [cfe] The method 'extensionMethod' isn't defined for the class 'A9'. } } @@ -342,38 +342,38 @@ extension E10 on A10 { void test() { // The static getter shadows the other extension's setter extensionSetter = extensionSetter + 1; -// ^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER -// [cfe] Setter not found: 'extensionSetter'. + // [error column 5, length 15] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER + // [cfe] Setter not found: 'extensionSetter'. extensionSetter++; -// ^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER -// [cfe] Setter not found: 'extensionSetter'. + // [error column 5, length 15] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER + // [cfe] Setter not found: 'extensionSetter'. extensionSetter = 0; -// ^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER -// [cfe] Setter not found: 'extensionSetter'. + // [error column 5, length 15] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER + // [cfe] Setter not found: 'extensionSetter'. // The static field shadows the other extension's setter extensionFieldSetter = extensionFieldSetter + 1; -// ^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL -// [cfe] Setter not found: 'extensionFieldSetter'. + // [error column 5, length 20] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL + // [cfe] Setter not found: 'extensionFieldSetter'. extensionFieldSetter++; -// ^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL -// [cfe] Setter not found: 'extensionFieldSetter'. + // [error column 5, length 20] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL + // [cfe] Setter not found: 'extensionFieldSetter'. extensionFieldSetter = 0; -// ^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL -// [cfe] Setter not found: 'extensionFieldSetter'. + // [error column 5, length 20] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL + // [cfe] Setter not found: 'extensionFieldSetter'. // The static getter shadows the other extensions method extensionMethod(4); -// ^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVOCATION_OF_NON_FUNCTION_EXPRESSION -// ^ -// [cfe] The method 'call' isn't defined for the class 'int'. + // [error column 5, length 15] + // [analyzer] COMPILE_TIME_ERROR.INVOCATION_OF_NON_FUNCTION_EXPRESSION + // ^ + // [cfe] The method 'call' isn't defined for the class 'int'. } } @@ -388,38 +388,38 @@ class A11 extends A10 { void test() { // The static getter shadows the other extension's setter extensionSetter = extensionSetter + 1; -// ^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER -// [cfe] Setter not found: 'extensionSetter'. + // [error column 5, length 15] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER + // [cfe] Setter not found: 'extensionSetter'. extensionSetter++; -// ^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER -// [cfe] Setter not found: 'extensionSetter'. + // [error column 5, length 15] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER + // [cfe] Setter not found: 'extensionSetter'. extensionSetter = 0; -// ^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER -// [cfe] Setter not found: 'extensionSetter'. + // [error column 5, length 15] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER + // [cfe] Setter not found: 'extensionSetter'. // The static field shadows the other extension's setter extensionFieldSetter = extensionFieldSetter + 1; -// ^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL -// [cfe] Setter not found: 'extensionFieldSetter'. + // [error column 5, length 20] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL + // [cfe] Setter not found: 'extensionFieldSetter'. extensionFieldSetter++; -// ^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL -// [cfe] Setter not found: 'extensionFieldSetter'. + // [error column 5, length 20] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL + // [cfe] Setter not found: 'extensionFieldSetter'. extensionFieldSetter = 0; -// ^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL -// [cfe] Setter not found: 'extensionFieldSetter'. + // [error column 5, length 20] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL + // [cfe] Setter not found: 'extensionFieldSetter'. // The static getter shadows the other extensions method extensionMethod(4); -// ^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVOCATION_OF_NON_FUNCTION_EXPRESSION -// ^ -// [cfe] The method 'call' isn't defined for the class 'int'. + // [error column 5, length 15] + // [analyzer] COMPILE_TIME_ERROR.INVOCATION_OF_NON_FUNCTION_EXPRESSION + // ^ + // [cfe] The method 'call' isn't defined for the class 'int'. } } @@ -437,23 +437,23 @@ extension E12 on A12 { void test() { // The static setter shadows the other extension's getter extensionGetter = extensionGetter + 1; -// ^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER -// [cfe] Getter not found: 'extensionGetter'. + // ^^^^^^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] Getter not found: 'extensionGetter'. extensionGetter++; -// ^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER -// [cfe] Getter not found: 'extensionGetter'. + // [error column 5, length 15] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] Getter not found: 'extensionGetter'. extensionGetter; -// ^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER -// [cfe] Getter not found: 'extensionGetter'. + // [error column 5, length 15] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] Getter not found: 'extensionGetter'. // The static setter shadows the other extension's method. extensionMethod(4); -// ^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD -// [cfe] Getter not found: 'extensionMethod'. + // [error column 5, length 15] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD + // [cfe] Getter not found: 'extensionMethod'. } } @@ -467,23 +467,23 @@ class A13 extends A12 { void test() { // The static setter shadows the other extension's getter extensionGetter = extensionGetter + 1; -// ^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER -// [cfe] Getter not found: 'extensionGetter'. + // ^^^^^^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] Getter not found: 'extensionGetter'. extensionGetter++; -// ^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER -// [cfe] Getter not found: 'extensionGetter'. + // [error column 5, length 15] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] Getter not found: 'extensionGetter'. extensionGetter; -// ^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER -// [cfe] Getter not found: 'extensionGetter'. + // [error column 5, length 15] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] Getter not found: 'extensionGetter'. // The static setter shadows the other extension's method. extensionMethod(4); -// ^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD -// [cfe] Getter not found: 'extensionMethod'. + // [error column 5, length 15] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD + // [cfe] Getter not found: 'extensionMethod'. } } diff --git a/tests/language/extension_methods/static_extension_internal_name_conflict_error_test.dart b/tests/language/extension_methods/static_extension_internal_name_conflict_error_test.dart index c2e821d1aa6..9d364b50072 100644 --- a/tests/language/extension_methods/static_extension_internal_name_conflict_error_test.dart +++ b/tests/language/extension_methods/static_extension_internal_name_conflict_error_test.dart @@ -6,9 +6,9 @@ // It is an error to have duplicate type parameter names. extension E1 on int { -// ^ -// [analyzer] COMPILE_TIME_ERROR.DUPLICATE_DEFINITION -// [cfe] A type variable can't have the same name as another. + // ^ + // [analyzer] COMPILE_TIME_ERROR.DUPLICATE_DEFINITION + // [cfe] A type variable can't have the same name as another. } extension E2 on int {} diff --git a/tests/language/extension_methods/static_extension_internal_resolution_4_error_test.dart b/tests/language/extension_methods/static_extension_internal_resolution_4_error_test.dart index dd09d1517dd..25bb273ba7a 100644 --- a/tests/language/extension_methods/static_extension_internal_resolution_4_error_test.dart +++ b/tests/language/extension_methods/static_extension_internal_resolution_4_error_test.dart @@ -236,23 +236,20 @@ class B extends A { bool t0 = fieldInExtensionScope; // ^^^^^^^^^^^^^^^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.AMBIGUOUS_EXTENSION_MEMBER_ACCESS - // [cfe] The property 'fieldInExtensionScope' is defined in multiple extensions for 'B' and neither is more specific. - // ^^^^^^^^^^^^^^^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] The property 'fieldInExtensionScope' is defined in multiple extensions for 'B' and neither is more specific. checkExtensionValue(t0); bool t1 = getterInExtensionScope; // ^^^^^^^^^^^^^^^^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.AMBIGUOUS_EXTENSION_MEMBER_ACCESS - // [cfe] The property 'getterInExtensionScope' is defined in multiple extensions for 'B' and neither is more specific. - // ^^^^^^^^^^^^^^^^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] The property 'getterInExtensionScope' is defined in multiple extensions for 'B' and neither is more specific. checkExtensionValue(t1); setterInExtensionScope = extensionValue; -// ^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.AMBIGUOUS_EXTENSION_MEMBER_ACCESS -// [cfe] The property 'setterInExtensionScope' is defined in multiple extensions for 'B' and neither is more specific. -// ^^^^^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [error column 7, length 22] + // [analyzer] COMPILE_TIME_ERROR.AMBIGUOUS_EXTENSION_MEMBER_ACCESS + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER + // [cfe] The property 'setterInExtensionScope' is defined in multiple extensions for 'B' and neither is more specific. bool t2 = methodInExtensionScope(); // ^^^^^^^^^^^^^^^^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.AMBIGUOUS_EXTENSION_MEMBER_ACCESS diff --git a/tests/language/extension_methods/static_extension_method_context_test.dart b/tests/language/extension_methods/static_extension_method_context_test.dart index cacdd71254d..8fffb7843a6 100644 --- a/tests/language/extension_methods/static_extension_method_context_test.dart +++ b/tests/language/extension_methods/static_extension_method_context_test.dart @@ -18,15 +18,23 @@ class C { main() { var string = ''; context( - string.f(contextType([1])..expectStaticType>>())); + string.f(contextType([1])..expectStaticType>>()), + ); context( - E(string).f(contextType([1])..expectStaticType>>())); + E(string).f(contextType([1])..expectStaticType>>()), + ); var nullableString = '' as String?; - context(nullableString - ?.f(contextType([1])..expectStaticType>>())); - context(E(nullableString) - ?.f(contextType([1])..expectStaticType>>())); + context( + nullableString?.f( + contextType([1])..expectStaticType>>(), + ), + ); + context( + E( + nullableString, + )?.f(contextType([1])..expectStaticType>>()), + ); // And just to verify that the expectations above are reasonable, repeat the // same thing with an ordinary class: @@ -34,5 +42,6 @@ main() { context(c.g(contextType([1])..expectStaticType>>())); var nullableC = C() as C?; context( - nullableC?.g(contextType([1])..expectStaticType>>())); + nullableC?.g(contextType([1])..expectStaticType>>()), + ); } diff --git a/tests/language/extension_methods/static_extension_operators_test.dart b/tests/language/extension_methods/static_extension_operators_test.dart index 0cf6359acfc..d4ad3bed99b 100644 --- a/tests/language/extension_methods/static_extension_operators_test.dart +++ b/tests/language/extension_methods/static_extension_operators_test.dart @@ -76,10 +76,14 @@ void main() { expect("(a+b[b(c)]((a*b)))", a + b[c[a] = b(c)](a * b), "c[a]=b(c)"); // Operator precedence is unaffected by being extensions. - expect("(c<((-a)|(b^((~c)&((a<>((c-a)+((((b*c)~/a)%b)/c)))))))", - c < -a | b ^ ~c & a << b >> c - a + b * c ~/ a % b / c); - expect("((((((((((((c/b)%a)~/c)*b)+a)-c)<>a)&(~c))^b)|(-a))>b)", - c / b % a ~/ c * b + a - c << b >> a & ~c ^ b | -a > b); + expect( + "(c<((-a)|(b^((~c)&((a<>((c-a)+((((b*c)~/a)%b)/c)))))))", + c < -a | b ^ ~c & a << b >> c - a + b * c ~/ a % b / c, + ); + expect( + "((((((((((((c/b)%a)~/c)*b)+a)-c)<>a)&(~c))^b)|(-a))>b)", + c / b % a ~/ c * b + a - c << b >> a & ~c ^ b | -a > b, + ); } // Last value set by []= or setter. diff --git a/tests/language/extension_methods/static_extension_property_set_context_test.dart b/tests/language/extension_methods/static_extension_property_set_context_test.dart index 19e96a9fccb..4dd88b1c867 100644 --- a/tests/language/extension_methods/static_extension_property_set_context_test.dart +++ b/tests/language/extension_methods/static_extension_property_set_context_test.dart @@ -23,17 +23,22 @@ main() { context(E(string).s1 = contextType(1)..expectStaticType>()); context(string.s2 = contextType(1)..expectStaticType>()); context( - E(string).s2 = contextType(1)..expectStaticType>()); + E(string).s2 = contextType(1)..expectStaticType>(), + ); var nullableString = '' as String?; context( - nullableString?.s1 = contextType(1)..expectStaticType>()); + nullableString?.s1 = contextType(1)..expectStaticType>(), + ); context( - E(nullableString)?.s1 = contextType(1)..expectStaticType>()); + E(nullableString)?.s1 = contextType(1)..expectStaticType>(), + ); context( - nullableString?.s2 = contextType(1)..expectStaticType>()); - context(E(nullableString)?.s2 = contextType(1) - ..expectStaticType>()); + nullableString?.s2 = contextType(1)..expectStaticType>(), + ); + context( + E(nullableString)?.s2 = contextType(1)..expectStaticType>(), + ); // And just to verify that the expectations above are reasonable, repeat the // same thing with an ordinary class: @@ -42,7 +47,9 @@ main() { context(c.s4 = contextType(1)..expectStaticType>()); var nullableC = C() as C?; context( - nullableC?.s3 = contextType(1)..expectStaticType>()); + nullableC?.s3 = contextType(1)..expectStaticType>(), + ); context( - nullableC?.s4 = contextType(1)..expectStaticType>()); + nullableC?.s4 = contextType(1)..expectStaticType>(), + ); } diff --git a/tests/language/extension_methods/static_extension_setter_getter_assignability_error_test.dart b/tests/language/extension_methods/static_extension_setter_getter_assignability_error_test.dart index e6e2b0b3c27..38cd8c04296 100644 --- a/tests/language/extension_methods/static_extension_setter_getter_assignability_error_test.dart +++ b/tests/language/extension_methods/static_extension_setter_getter_assignability_error_test.dart @@ -7,21 +7,15 @@ // of the setter. extension E1 on int { static int get property => 1; - // ^^ - // [cfe] unspecified // ^^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.GETTER_NOT_SUBTYPE_SETTER_TYPES + // [cfe] The type 'int' of the getter 'property' is not a subtype of the type 'String' of the setter 'property'. static void set property(String value) {} - // ^^ - // [cfe] unspecified int get property2 => 1; - // ^^ - // [cfe] unspecified // ^^^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.GETTER_NOT_SUBTYPE_SETTER_TYPES + // [cfe] The type 'int' of the getter 'property2' is not a subtype of the type 'String' of the setter 'property2'. void set property2(String x) {} - // ^^ - // [cfe] unspecified } void main() {} diff --git a/tests/language/extension_methods/static_extension_this_not_promoted_error_test.dart b/tests/language/extension_methods/static_extension_this_not_promoted_error_test.dart index bedb6da9ab2..e8db6a3ffb1 100644 --- a/tests/language/extension_methods/static_extension_this_not_promoted_error_test.dart +++ b/tests/language/extension_methods/static_extension_this_not_promoted_error_test.dart @@ -17,7 +17,6 @@ extension on C? { f(this.cProp); // ^^^^^ // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE - // ^ // [cfe] Property 'cProp' cannot be accessed on 'C?' because it is potentially null. f(cProp); //^^^^^ diff --git a/tests/language/extension_type/exhaustiveness_error_test.dart b/tests/language/extension_type/exhaustiveness_error_test.dart index 8f5bab0c952..39e1637b191 100644 --- a/tests/language/extension_type/exhaustiveness_error_test.dart +++ b/tests/language/extension_type/exhaustiveness_error_test.dart @@ -18,23 +18,23 @@ extension type ExtensionTypeMap(Map it) implements Map { nonExhaustiveSealedSubtype(ExtensionTypeList list) { return switch (list) { - // ^^^^^^ - // [analyzer] COMPILE_TIME_ERROR.NON_EXHAUSTIVE_SWITCH_EXPRESSION - // ^ - // [cfe] The type 'ExtensionTypeList' is not exhaustively matched by the switch cases since it doesn't match '[B(), C()]'. - [] => 0, - [_] => 1, - [_, B()] => 2, - [_, _, _, ...] => 3, - }; + // ^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.NON_EXHAUSTIVE_SWITCH_EXPRESSION + // ^ + // [cfe] The type 'ExtensionTypeList' is not exhaustively matched by the switch cases since it doesn't match '[B(), C()]'. + [] => 0, + [_] => 1, + [_, B()] => 2, + [_, _, _, ...] => 3, + }; } nonExhaustiveMapExtensionType1(ExtensionTypeMap map) { var a = switch (map) { - // ^^^^^^ - // [analyzer] COMPILE_TIME_ERROR.NON_EXHAUSTIVE_SWITCH_EXPRESSION - // ^ - // [cfe] The type 'ExtensionTypeMap' is not exhaustively matched by the switch cases since it doesn't match 'Map(isEmpty: false)'. + // ^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.NON_EXHAUSTIVE_SWITCH_EXPRESSION + // ^ + // [cfe] The type 'ExtensionTypeMap' is not exhaustively matched by the switch cases since it doesn't match 'Map(isEmpty: false)'. Map(isEmpty: true) => 0, {0: B b, 1: _} => 4, {0: C c, 1: _} => 5, @@ -47,52 +47,54 @@ nonExhaustiveMapExtensionType1(ExtensionTypeMap map) { } nonExhaustiveMapExtensionType2(ExtensionTypeMap map) { - var c = switch (map) { - // ^^^^^^ - // [analyzer] COMPILE_TIME_ERROR.NON_EXHAUSTIVE_SWITCH_EXPRESSION - // ^ - // [cfe] The type 'ExtensionTypeMap' is not exhaustively matched by the switch cases since it doesn't match 'Map()'. + var c = switch (map) { + // ^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.NON_EXHAUSTIVE_SWITCH_EXPRESSION + // ^ + // [cfe] The type 'ExtensionTypeMap' is not exhaustively matched by the switch cases since it doesn't match 'Map()'. Map() => 0, }; } nonExhaustiveMapMethod(ExtensionTypeMap map) { return switch (map) { - // ^^^^^^ - // [analyzer] COMPILE_TIME_ERROR.NON_EXHAUSTIVE_SWITCH_EXPRESSION - // ^ - // [cfe] The type 'ExtensionTypeMap' is not exhaustively matched by the switch cases since it doesn't match 'Map(method: A Function(int) _)'. + // ^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.NON_EXHAUSTIVE_SWITCH_EXPRESSION + // ^ + // [cfe] The type 'ExtensionTypeMap' is not exhaustively matched by the switch cases since it doesn't match 'Map(method: A Function(int) _)'. ExtensionTypeMap(:B Function(int) method) => 0, }; } nonExhaustiveMapGetter(ExtensionTypeMap map) { return switch (map) { - // ^^^^^^ - // [analyzer] COMPILE_TIME_ERROR.NON_EXHAUSTIVE_SWITCH_EXPRESSION - // ^ - // [cfe] The type 'ExtensionTypeMap' is not exhaustively matched by the switch cases since it doesn't match 'Map(getter: C())'. + // ^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.NON_EXHAUSTIVE_SWITCH_EXPRESSION + // ^ + // [cfe] The type 'ExtensionTypeMap' is not exhaustively matched by the switch cases since it doesn't match 'Map(getter: C())'. ExtensionTypeMap(:B getter) => 0, }; } nonExhaustiveMapGenericMethod(ExtensionTypeMap map) { return switch (map) { - // ^^^^^^ - // [analyzer] COMPILE_TIME_ERROR.NON_EXHAUSTIVE_SWITCH_EXPRESSION - // ^ - // [cfe] The type 'ExtensionTypeMap' is not exhaustively matched by the switch cases since it doesn't match 'Map(genericMethod: void Function(int, A, void Function(T)) _)'. + // ^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.NON_EXHAUSTIVE_SWITCH_EXPRESSION + // ^ + // [cfe] The type 'ExtensionTypeMap' is not exhaustively matched by the switch cases since it doesn't match 'Map(genericMethod: void Function(int, A, void Function(T)) _)'. ExtensionTypeMap( - :void Function(int, B, void Function(X)) genericMethod) => 0, + :void Function(int, B, void Function(X)) genericMethod, + ) => + 0, }; } nonExhaustiveMapField(ExtensionTypeMap map) { return switch (map) { - // ^^^^^^ - // [analyzer] COMPILE_TIME_ERROR.NON_EXHAUSTIVE_SWITCH_EXPRESSION - // ^ - // [cfe] The type 'ExtensionTypeMap' is not exhaustively matched by the switch cases since it doesn't match 'Map(it: Map())'. + // ^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.NON_EXHAUSTIVE_SWITCH_EXPRESSION + // ^ + // [cfe] The type 'ExtensionTypeMap' is not exhaustively matched by the switch cases since it doesn't match 'Map(it: Map())'. ExtensionTypeMap(:Map it) => 0, }; } diff --git a/tests/language/extension_type/exhaustiveness_test.dart b/tests/language/extension_type/exhaustiveness_test.dart index 3b2b1769546..8eb0a933732 100644 --- a/tests/language/extension_type/exhaustiveness_test.dart +++ b/tests/language/extension_type/exhaustiveness_test.dart @@ -20,11 +20,11 @@ extension type ExtensionTypeMap(Map it) implements Map { exhaustiveListExtensionType(ExtensionTypeList list) { return switch (list) { - [] => 0, - [B()] => 1, - [C()] => 2, - [_, _, ...]=> 3, - }; + [] => 0, + [B()] => 1, + [C()] => 2, + [_, _, ...] => 3, + }; } exhaustiveMapExtensionType1(ExtensionTypeMap map) { @@ -68,7 +68,9 @@ exhaustiveMapGetter(ExtensionTypeMap map) { exhaustiveMapGenericMethod(ExtensionTypeMap map) { return switch (map) { ExtensionTypeMap( - :void Function(int, A, void Function(X)) genericMethod) => 0, + :void Function(int, A, void Function(X)) genericMethod, + ) => + 0, }; } diff --git a/tests/language/extension_type/inherited_combined_member_signature_test.dart b/tests/language/extension_type/inherited_combined_member_signature_test.dart index d92b64ab650..f8f00676f4b 100644 --- a/tests/language/extension_type/inherited_combined_member_signature_test.dart +++ b/tests/language/extension_type/inherited_combined_member_signature_test.dart @@ -35,4 +35,4 @@ method(G g, T t) { main() { method(G(EImpl()), 0); method(G(EImpl()), ''); -} \ No newline at end of file +} diff --git a/tests/language/extension_type/match_against_non_extension_types_in_inference_test.dart b/tests/language/extension_type/match_against_non_extension_types_in_inference_test.dart index 79f44bd9b21..9e46d517ddc 100644 --- a/tests/language/extension_type/match_against_non_extension_types_in_inference_test.dart +++ b/tests/language/extension_type/match_against_non_extension_types_in_inference_test.dart @@ -26,9 +26,7 @@ num Function(A) producingFunctionA() => ((A a) => 0); test2() => acceptingFunctionET1(producingFunctionA()).expectStaticType>(); -enum E { - element(); -} +enum E { element() } extension type ET2(E it) implements E {} @@ -39,7 +37,8 @@ ET2 producingET2() => ET2(producingE()); // In type constraint generation, ET2 is compared against E, // yielding the constraint T <: String. test3() => context>( - producingET2()..expectStaticType>>()); + producingET2()..expectStaticType>>(), +); T acceptingFunctionET2(T Function(ET2) f) => f(ET2(producingE())); @@ -47,8 +46,10 @@ String Function(E) producingFunctionE() => ((E e) => ""); // In type constraint generation, E is compared against ET2, // yielding the constraint String <: T. -test4() => acceptingFunctionET2(producingFunctionE()) - .expectStaticType>(); +test4() => + acceptingFunctionET2( + producingFunctionE(), + ).expectStaticType>(); extension type ET3(A it) implements ET1 {} @@ -73,14 +74,17 @@ ET4 producingET4() => ET4(producingE()); // In type constraint generation, ET4 is compared against E, // yielding the constraint T <: String. test7() => context>( - producingET4()..expectStaticType>>()); + producingET4()..expectStaticType>>(), +); T acceptingFunctionET4(Function(ET4) f) => f(ET4(producingE())); // In type constraint generation, E is compared against ET4, // yielding the constraint String <: T. -test8() => acceptingFunctionET4(producingFunctionE()) - .expectStaticType>(); +test8() => + acceptingFunctionET4( + producingFunctionE(), + ).expectStaticType>(); main() { test1(); diff --git a/tests/language/extension_type/pattern_test.dart b/tests/language/extension_type/pattern_test.dart index 7ea1ce455ef..4ef22338eb4 100644 --- a/tests/language/extension_type/pattern_test.dart +++ b/tests/language/extension_type/pattern_test.dart @@ -74,4 +74,4 @@ main() { testMapSwitch(MyMap({'foo': 5}), 1); testMapSwitch(MyMap({'bar': 4}), 4); testMapSwitch(MyMap({'bar': 7}), 1); -} \ No newline at end of file +} diff --git a/tests/language/extension_type/regress_53607_test.dart b/tests/language/extension_type/regress_53607_test.dart index cb70cf7692b..09213c213c3 100644 --- a/tests/language/extension_type/regress_53607_test.dart +++ b/tests/language/extension_type/regress_53607_test.dart @@ -8,12 +8,12 @@ // and getters "conflicting" with them. extension type const Ext1.name0(int i) { Ext1.name1(this.i); - Ext1.name2(int i): this.name0(i); + Ext1.name2(int i) : this.name0(i); factory Ext1.name3(int i) = Ext1.name0; factory Ext1.name4(int i) => Ext1.name0(i); const Ext1.name5(this.i); - const Ext1.name6(int i): this.name0(i); + const Ext1.name6(int i) : this.name0(i); const factory Ext1.name7(int i) = Ext1.name0; int get name0 => i; @@ -35,18 +35,17 @@ class C { // Other instance members with same name as constructors, // both extension and interface members. extension type const Ext2.name0(C _) implements C { - Ext2.name1(): this.name0(C()); - Ext2.name2(): this.name0(C()); - Ext2.name3(): this.name0(C()); - Ext2.name4(): this.name0(C()); - Ext2.name5(): this.name0(C()); + Ext2.name1() : this.name0(C()); + Ext2.name2() : this.name0(C()); + Ext2.name3() : this.name0(C()); + Ext2.name4() : this.name0(C()); + Ext2.name5() : this.name0(C()); int get name0 => 0; set name1(int i) {} int name2() => 0; } - void main() { Ext1 e = Ext1.name0(0); var res = [ @@ -62,13 +61,6 @@ void main() { if (res.length != 8) throw AssertionError("Sanity check failed"); Ext2 c = Ext2.name0(C()); - var res2 = [ - c.name0, - c.name1 = 0, - c.name2(), - c.name3, - c.name4 = 0, - c.name5(), - ]; + var res2 = [c.name0, c.name1 = 0, c.name2(), c.name3, c.name4 = 0, c.name5()]; if (res2.length != 6) throw AssertionError("Sanity check failed"); } diff --git a/tests/language/extension_type/regress_53610_test.dart b/tests/language/extension_type/regress_53610_test.dart index 09f7c37aff0..f342498f975 100644 --- a/tests/language/extension_type/regress_53610_test.dart +++ b/tests/language/extension_type/regress_53610_test.dart @@ -9,4 +9,4 @@ extension type const E(Null _) {} void main() { E e = const E(null); // Failed here. assert(e._ == null); -} \ No newline at end of file +} diff --git a/tests/language/extension_type/spread_test.dart b/tests/language/extension_type/spread_test.dart index 44c40dee09e..09197d997bb 100644 --- a/tests/language/extension_type/spread_test.dart +++ b/tests/language/extension_type/spread_test.dart @@ -15,13 +15,11 @@ List copyList(MyList list) { return copy; } - Set copySet(MySet set) { var copy = {...set}; return copy; } - Map copyMap(MyMap map) { var copy = {...map}; return copy; @@ -29,11 +27,11 @@ Map copyMap(MyMap map) { main() { MyList list = MyList([1, 2, 3]); - Expect.deepEquals(list , copyList(list)); + Expect.deepEquals(list, copyList(list)); MySet set = MySet({1, 2, 3}); - Expect.deepEquals(set , copySet(set)); + Expect.deepEquals(set, copySet(set)); MyMap map = MyMap({1: true, 2: false, 3: true}); - Expect.deepEquals(map , copyMap(map)); -} \ No newline at end of file + Expect.deepEquals(map, copyMap(map)); +} diff --git a/tests/language/extension_type/yield_test.dart b/tests/language/extension_type/yield_test.dart index 0498763befe..1fb89a0eaa1 100644 --- a/tests/language/extension_type/yield_test.dart +++ b/tests/language/extension_type/yield_test.dart @@ -26,7 +26,7 @@ Iterable duplicateList(MyList list) sync* { Stream toStream(MyList list) async* { for (var a in list) { - yield a; + yield a; } } @@ -54,6 +54,12 @@ main() async { Expect.listEquals([1, 2, 3], await toList(stream)); MyStream stream1 = MyStream(toStream(list)); MyStream stream2 = MyStream(toStream(list)); - Expect.listEquals([1, 2, 3, 1, 2, 3], - await toList(MyStream(duplicateStream(stream1, stream2)))); -} \ No newline at end of file + Expect.listEquals([ + 1, + 2, + 3, + 1, + 2, + 3, + ], await toList(MyStream(duplicateStream(stream1, stream2)))); +} diff --git a/tests/language/external_abstract_fields/abstract_fields_error_test.dart b/tests/language/external_abstract_fields/abstract_fields_error_test.dart index ca9fb388c9e..21e881145b8 100644 --- a/tests/language/external_abstract_fields/abstract_fields_error_test.dart +++ b/tests/language/external_abstract_fields/abstract_fields_error_test.dart @@ -7,13 +7,13 @@ // Check that abstract declarations are abstract. class Abstract1 { -// ^ -// [cfe] The non-abstract class 'Abstract1' is missing implementations for these members: + // ^ + // [cfe] The non-abstract class 'Abstract1' is missing implementations for these members: // The class is not abstract and does not have an implementation of `x`. abstract int x; - // ^ - // [analyzer] unspecified + // [error column 3, length 15] + // [analyzer] COMPILE_TIME_ERROR.CONCRETE_CLASS_WITH_ABSTRACT_MEMBER } // Check that class has expected interface. @@ -29,9 +29,8 @@ abstract class Abstract2 { // Cannot assign to final field. a.x = 42; //^ + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL // [cfe] The setter 'x' isn't defined for the class 'Abstract2'. - // ^ - // [analyzer] unspecified String y = a.y; a.y = "ab"; @@ -39,7 +38,7 @@ abstract class Abstract2 { // Cannot assign something of wrong type, even if covariant. a.y = Object(); // ^^^^^^^^ - // [analyzer] unspecified + // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT // [cfe] A value of type 'Object' can't be assigned to a variable of type 'String'. } @@ -49,9 +48,8 @@ abstract class Abstract2 { // Cannot assign to final field. this.x = 42; // ^ + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL // [cfe] The setter 'x' isn't defined for the class 'Abstract2'. - // ^ - // [analyzer] unspecified String y = this.y; this.y = "ab"; @@ -59,7 +57,7 @@ abstract class Abstract2 { // Cannot assign something of wrong type, even if covariant. this.y = Object(); // ^^^^^^^^ - // [analyzer] unspecified + // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT // [cfe] A value of type 'Object' can't be assigned to a variable of type 'String'. } } diff --git a/tests/language/external_abstract_fields/abstract_fields_test.dart b/tests/language/external_abstract_fields/abstract_fields_test.dart index c946ed79f01..c66f31f4af1 100644 --- a/tests/language/external_abstract_fields/abstract_fields_test.dart +++ b/tests/language/external_abstract_fields/abstract_fields_test.dart @@ -23,8 +23,8 @@ class D { int u1, u2; covariant int v1, v2, v3; covariant var w; - D() : - x1 = 0, + D() + : x1 = 0, x2 = 0, y1 = 1, y2 = 1, @@ -42,7 +42,8 @@ class D { class E extends D implements C {} // Valid declarations when superclass has implementation. -class F extends D { // Class is not abstract. +class F extends D { + // Class is not abstract. abstract int x1, x2; abstract var y1, y2, y3; abstract final z; @@ -60,14 +61,17 @@ class Logger { lastName = #x; return _x; } + set x(String value) { lastName = #x; _x = value; } + int get y { lastName = #y; return _y; } + set y(int value) { lastName = #y; _y = value; diff --git a/tests/language/external_abstract_fields/external_fields_error_test.dart b/tests/language/external_abstract_fields/external_fields_error_test.dart index 394d6cf0d47..d866b1d9711 100644 --- a/tests/language/external_abstract_fields/external_fields_error_test.dart +++ b/tests/language/external_abstract_fields/external_fields_error_test.dart @@ -22,9 +22,9 @@ class External2 { // Cannot assign to final field. a.x = 42; - // ^ - // [analyzer] unspecified - // [cfe] unspecified + //^ + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL + // [cfe] The setter 'x' isn't defined for the class 'External2'. String y = a.y; a.y = "ab"; @@ -32,8 +32,8 @@ class External2 { // Cannot assign something of wrong type, even if covariant. a.y = Object(); // ^^^^^^^^ - // [analyzer] unspecified - // [cfe] unspecified + // [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT + // [cfe] A value of type 'Object' can't be assigned to a variable of type 'String'. } }