diff --git a/tests/language/scaling/medium_offset_type_parameter_test.dart b/tests/language/scaling/medium_offset_type_parameter_test.dart index 1817192c867..e5a6c059726 100644 --- a/tests/language/scaling/medium_offset_type_parameter_test.dart +++ b/tests/language/scaling/medium_offset_type_parameter_test.dart @@ -5,523 +5,525 @@ // VMOptions=--optimization-counter-threshold=100 --no-use-osr --no-background-compilation class C< - T0, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8, - T9, - T10, - T11, - T12, - T13, - T14, - T15, - T16, - T17, - T18, - T19, - T20, - T21, - T22, - T23, - T24, - T25, - T26, - T27, - T28, - T29, - T30, - T31, - T32, - T33, - T34, - T35, - T36, - T37, - T38, - T39, - T40, - T41, - T42, - T43, - T44, - T45, - T46, - T47, - T48, - T49, - T50, - T51, - T52, - T53, - T54, - T55, - T56, - T57, - T58, - T59, - T60, - T61, - T62, - T63, - T64, - T65, - T66, - T67, - T68, - T69, - T70, - T71, - T72, - T73, - T74, - T75, - T76, - T77, - T78, - T79, - T80, - T81, - T82, - T83, - T84, - T85, - T86, - T87, - T88, - T89, - T90, - T91, - T92, - T93, - T94, - T95, - T96, - T97, - T98, - T99, - T100, - T101, - T102, - T103, - T104, - T105, - T106, - T107, - T108, - T109, - T110, - T111, - T112, - T113, - T114, - T115, - T116, - T117, - T118, - T119, - T120, - T121, - T122, - T123, - T124, - T125, - T126, - T127, - T128, - T129, - T130, - T131, - T132, - T133, - T134, - T135, - T136, - T137, - T138, - T139, - T140, - T141, - T142, - T143, - T144, - T145, - T146, - T147, - T148, - T149, - T150, - T151, - T152, - T153, - T154, - T155, - T156, - T157, - T158, - T159, - T160, - T161, - T162, - T163, - T164, - T165, - T166, - T167, - T168, - T169, - T170, - T171, - T172, - T173, - T174, - T175, - T176, - T177, - T178, - T179, - T180, - T181, - T182, - T183, - T184, - T185, - T186, - T187, - T188, - T189, - T190, - T191, - T192, - T193, - T194, - T195, - T196, - T197, - T198, - T199, - T200, - T201, - T202, - T203, - T204, - T205, - T206, - T207, - T208, - T209, - T210, - T211, - T212, - T213, - T214, - T215, - T216, - T217, - T218, - T219, - T220, - T221, - T222, - T223, - T224, - T225, - T226, - T227, - T228, - T229, - T230, - T231, - T232, - T233, - T234, - T235, - T236, - T237, - T238, - T239, - T240, - T241, - T242, - T243, - T244, - T245, - T246, - T247, - T248, - T249, - T250, - T251, - T252, - T253, - T254, - T255, - T256> { + T0, + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + T16, + T17, + T18, + T19, + T20, + T21, + T22, + T23, + T24, + T25, + T26, + T27, + T28, + T29, + T30, + T31, + T32, + T33, + T34, + T35, + T36, + T37, + T38, + T39, + T40, + T41, + T42, + T43, + T44, + T45, + T46, + T47, + T48, + T49, + T50, + T51, + T52, + T53, + T54, + T55, + T56, + T57, + T58, + T59, + T60, + T61, + T62, + T63, + T64, + T65, + T66, + T67, + T68, + T69, + T70, + T71, + T72, + T73, + T74, + T75, + T76, + T77, + T78, + T79, + T80, + T81, + T82, + T83, + T84, + T85, + T86, + T87, + T88, + T89, + T90, + T91, + T92, + T93, + T94, + T95, + T96, + T97, + T98, + T99, + T100, + T101, + T102, + T103, + T104, + T105, + T106, + T107, + T108, + T109, + T110, + T111, + T112, + T113, + T114, + T115, + T116, + T117, + T118, + T119, + T120, + T121, + T122, + T123, + T124, + T125, + T126, + T127, + T128, + T129, + T130, + T131, + T132, + T133, + T134, + T135, + T136, + T137, + T138, + T139, + T140, + T141, + T142, + T143, + T144, + T145, + T146, + T147, + T148, + T149, + T150, + T151, + T152, + T153, + T154, + T155, + T156, + T157, + T158, + T159, + T160, + T161, + T162, + T163, + T164, + T165, + T166, + T167, + T168, + T169, + T170, + T171, + T172, + T173, + T174, + T175, + T176, + T177, + T178, + T179, + T180, + T181, + T182, + T183, + T184, + T185, + T186, + T187, + T188, + T189, + T190, + T191, + T192, + T193, + T194, + T195, + T196, + T197, + T198, + T199, + T200, + T201, + T202, + T203, + T204, + T205, + T206, + T207, + T208, + T209, + T210, + T211, + T212, + T213, + T214, + T215, + T216, + T217, + T218, + T219, + T220, + T221, + T222, + T223, + T224, + T225, + T226, + T227, + T228, + T229, + T230, + T231, + T232, + T233, + T234, + T235, + T236, + T237, + T238, + T239, + T240, + T241, + T242, + T243, + T244, + T245, + T246, + T247, + T248, + T249, + T250, + T251, + T252, + T253, + T254, + T255, + T256 +> { @pragma("vm:never-inline") static create() { return new C< - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - double, - T>(); + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + double, + T + >(); } @pragma("vm:never-inline") diff --git a/tests/language/script/script1_test.dart b/tests/language/script/script1_test.dart index 8d714e97309..457468e8d94 100644 --- a/tests/language/script/script1_test.dart +++ b/tests/language/script/script1_test.dart @@ -6,7 +6,7 @@ part "script1_part.dart"; import "script1_lib.dart"; -// [error line 8, column 1, length 6] +// [error column 1, length 6] // [analyzer] SYNTACTIC_ERROR.IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE // [cfe] Import directives must precede part directives. diff --git a/tests/language/sealed_class/sealed_class_as_mixin_error_test.dart b/tests/language/sealed_class/sealed_class_as_mixin_error_test.dart index 7fea3b308a0..ec6dbed8c86 100644 --- a/tests/language/sealed_class/sealed_class_as_mixin_error_test.dart +++ b/tests/language/sealed_class/sealed_class_as_mixin_error_test.dart @@ -14,11 +14,11 @@ abstract class OutsideA with SealedClass {} // [cfe] The class 'SealedClass' can't be used as a mixin because it isn't a mixin class nor a mixin. class OutsideB with SealedClass { -// ^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.CLASS_USED_AS_MIXIN -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY -// [cfe] The class 'SealedClass' can't be extended, implemented, or mixed in outside of its library because it's a sealed class. -// [cfe] The class 'SealedClass' can't be used as a mixin because it isn't a mixin class nor a mixin. + // ^^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.CLASS_USED_AS_MIXIN + // [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY + // [cfe] The class 'SealedClass' can't be extended, implemented, or mixed in outside of its library because it's a sealed class. + // [cfe] The class 'SealedClass' can't be used as a mixin because it isn't a mixin class nor a mixin. int foo = 2; int bar(int value) => value; } @@ -46,3 +46,4 @@ abstract class OutsideE with Mixin, SealedClass {} // [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'SealedClass' can't be extended, implemented, or mixed in outside of its library because it's a sealed class. // [cfe] The class 'SealedClass' can't be used as a mixin because it isn't a mixin class nor a mixin. + diff --git a/tests/language/sealed_class/sealed_class_extend_error_test.dart b/tests/language/sealed_class/sealed_class_extend_error_test.dart index 13d4148d481..71e37039cdd 100644 --- a/tests/language/sealed_class/sealed_class_extend_error_test.dart +++ b/tests/language/sealed_class/sealed_class_extend_error_test.dart @@ -12,9 +12,9 @@ abstract class OutsideA extends SealedClass {} // [cfe] The class 'SealedClass' can't be extended, implemented, or mixed in outside of its library because it's a sealed class. class OutsideB extends SealedClass { -// ^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY -// [cfe] The class 'SealedClass' can't be extended, implemented, or mixed in outside of its library because it's a sealed class. + // ^^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY + // [cfe] The class 'SealedClass' can't be extended, implemented, or mixed in outside of its library because it's a sealed class. int foo = 2; int bar(int value) => value; } diff --git a/tests/language/sealed_class/sealed_class_implement_error_test.dart b/tests/language/sealed_class/sealed_class_implement_error_test.dart index 5749bc6c93f..0c4c9afdf96 100644 --- a/tests/language/sealed_class/sealed_class_implement_error_test.dart +++ b/tests/language/sealed_class/sealed_class_implement_error_test.dart @@ -12,9 +12,9 @@ abstract class OutsideA implements SealedClass {} // [cfe] The class 'SealedClass' can't be extended, implemented, or mixed in outside of its library because it's a sealed class. class OutsideB implements SealedClass { -// ^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY -// [cfe] The class 'SealedClass' can't be extended, implemented, or mixed in outside of its library because it's a sealed class. + // ^^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY + // [cfe] The class 'SealedClass' can't be extended, implemented, or mixed in outside of its library because it's a sealed class. int nonAbstractFoo = 2; int foo = 2; int nonAbstractBar(int value) => value; @@ -30,3 +30,4 @@ enum EnumOutside implements ClassForEnum { x } // ^^^^^^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY // [cfe] The class 'ClassForEnum' can't be extended, implemented, or mixed in outside of its library because it's a sealed class. + diff --git a/tests/language/sealed_class/sealed_class_typedef_error_test.dart b/tests/language/sealed_class/sealed_class_typedef_error_test.dart index 40953e031e2..76258365d5e 100644 --- a/tests/language/sealed_class/sealed_class_typedef_error_test.dart +++ b/tests/language/sealed_class/sealed_class_typedef_error_test.dart @@ -13,8 +13,8 @@ class ATypeDef extends SealedClassTypeDef {} // [cfe] The class 'SealedClass' can't be extended, implemented, or mixed in outside of its library because it's a sealed class. class BTypeDef implements SealedClassTypeDef { -// ^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY -// [cfe] The class 'SealedClass' can't be extended, implemented, or mixed in outside of its library because it's a sealed class. + // ^^^^^^^^^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY + // [cfe] The class 'SealedClass' can't be extended, implemented, or mixed in outside of its library because it's a sealed class. int foo = 1; } diff --git a/tests/language/sealed_class/sealed_class_typedef_used_outside_error_test.dart b/tests/language/sealed_class/sealed_class_typedef_used_outside_error_test.dart index bdfeeeab692..6ec2ae03aa1 100644 --- a/tests/language/sealed_class/sealed_class_typedef_used_outside_error_test.dart +++ b/tests/language/sealed_class/sealed_class_typedef_used_outside_error_test.dart @@ -16,8 +16,8 @@ class A extends ATypeDef {} // [cfe] The class 'SealedClass' can't be extended, implemented, or mixed in outside of its library because it's a sealed class. class B implements ATypeDef { -// ^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY -// [cfe] The class 'SealedClass' can't be extended, implemented, or mixed in outside of its library because it's a sealed class. + // ^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.INVALID_USE_OF_TYPE_OUTSIDE_LIBRARY + // [cfe] The class 'SealedClass' can't be extended, implemented, or mixed in outside of its library because it's a sealed class. int foo = 1; } diff --git a/tests/language/set_literals/const_set_literal_test.dart b/tests/language/set_literals/const_set_literal_test.dart index 0e7c57dcda4..1b0c229b309 100644 --- a/tests/language/set_literals/const_set_literal_test.dart +++ b/tests/language/set_literals/const_set_literal_test.dart @@ -70,18 +70,25 @@ void test() { checkSet(const {#foo, #bar}, [#foo, #bar]); checkSet(const {#_foo, #_bar}, [#_foo, #_bar]); const object = Object(); - checkSet(const {#foo, 1, "string", object, true}, - [#foo, 1, "string", object, true]); + checkSet( + const {#foo, 1, "string", object, true}, + [#foo, 1, "string", object, true], + ); // Nested constant literals. - const Object o = {{2}}; + const Object o = { + {2}, + }; Expect.type>>(o); Set> set = o as Set>; Expect.equals(1, set.length); Expect.equals(1, set.first.length); Expect.equals(2, set.first.first); - const Object o2 = {{2}, {}}; + const Object o2 = { + {2}, + {}, + }; Expect.type>>(o); set = o2 as Set>; Expect.equals(2, set.length); @@ -97,7 +104,10 @@ void test() { Expect.equals(1, o4.length); Expect.equals(0, o4.first.length); - const o5 = {{1}, {}}; // Set + const o5 = { + {1}, + {}, + }; // Set Expect.type>(o5); Expect.notType>>(o5); diff --git a/tests/language/set_literals/in_annotations_test.dart b/tests/language/set_literals/in_annotations_test.dart index d59dfa992e0..7abb574dba1 100644 --- a/tests/language/set_literals/in_annotations_test.dart +++ b/tests/language/set_literals/in_annotations_test.dart @@ -26,7 +26,7 @@ class A<@Meta({}) T> { @Meta({}) enum E { @Meta({}) - v + v, } class Meta { diff --git a/tests/language/set_literals/set_literal_test.dart b/tests/language/set_literals/set_literal_test.dart index ee2d27c7564..2a05308530c 100644 --- a/tests/language/set_literals/set_literal_test.dart +++ b/tests/language/set_literals/set_literal_test.dart @@ -79,12 +79,17 @@ void test() { entries.add(entry); return value; } + checkSet( - {log(e1a, 1), log(e2b, 2), log(e1b, 3), log(e2a, 4)}, [e1a, e2b]); + {log(e1a, 1), log(e2b, 2), log(e1b, 3), log(e2a, 4)}, + [e1a, e2b], + ); Expect.listEquals([1, 2, 3, 4], entries); // Nested literals. - Object o = {{2}}; + Object o = { + {2}, + }; Expect.type>>(o); Expect.type>((o as Set).first); Set> set = o as Set>; @@ -92,7 +97,10 @@ void test() { Expect.equals(1, set.first.length); Expect.equals(2, set.first.first); - o = {{2}, {}}; + o = { + {2}, + {}, + }; Expect.type>>(o); Expect.type>((o as Set).first); set = o as Set>; @@ -105,17 +113,26 @@ void test() { Expect.equals(1, set2.length); Expect.equals(0, set2.first.length); - var set3 = {{1}, {}}; // Set + var set3 = { + {1}, + {}, + }; // Set Expect.type>(set3); Expect.notType>>(set3); // Trailing comma. Iterable i; + // Don't let the formatter remove the trailing commas. + // dart format off i = {1,}; + // dart format on Expect.type>(i); Expect.equals(1, i.length); + // Don't let the formatter remove the trailing commas. + // dart format off Object o2 = {1, 2, 3,}; + // dart format on Expect.type>(o2); Set set4 = o2 as Set; Expect.equals(3, set4.length); @@ -126,6 +143,6 @@ class Equality { final String name; const Equality(this.id, this.name); int get hashCode => id; - bool operator==(Object other) => other is Equality && id == other.id; + bool operator ==(Object other) => other is Equality && id == other.id; String toString() => "$id:$name"; } diff --git a/tests/language/setter/declaration_test.dart b/tests/language/setter/declaration_test.dart index 78d5e812aad..a89958a85ef 100644 --- a/tests/language/setter/declaration_test.dart +++ b/tests/language/setter/declaration_test.dart @@ -18,18 +18,18 @@ set tooMany(var value, var extra) {} // ^ // [cfe] A setter should have exactly one formal parameter. -/*space*/ int? set wrongReturnType1(_) => 1; -// ^^^^ +int? set wrongReturnType1(_) => 1; +// [error column 1, length 4] // [analyzer] COMPILE_TIME_ERROR.NON_VOID_RETURN_FOR_SETTER // [cfe] The return type of the setter must be 'void' or absent. -/*space*/ FutureOr set wrongReturnType2(_) {} -// ^^^^^^^^^^^^^^ +FutureOr set wrongReturnType2(_) {} +// [error column 1, length 14] // [analyzer] COMPILE_TIME_ERROR.NON_VOID_RETURN_FOR_SETTER // [cfe] The return type of the setter must be 'void' or absent. -/*space*/ Never set wrongReturnType3(_) => throw 1; -// ^^^^^ +Never set wrongReturnType3(_) => throw 1; +// [error column 1, length 5] // [analyzer] COMPILE_TIME_ERROR.NON_VOID_RETURN_FOR_SETTER // [cfe] The return type of the setter must be 'void' or absent. @@ -73,18 +73,18 @@ class C { // [analyzer] COMPILE_TIME_ERROR.NON_VOID_RETURN_FOR_SETTER // [cfe] The return type of the setter must be 'void' or absent. - /*space*/ int? set wrongReturnType1(_) => 1; - // ^^^^ + int? set wrongReturnType1(_) => 1; + // [error column 3, length 4] // [analyzer] COMPILE_TIME_ERROR.NON_VOID_RETURN_FOR_SETTER // [cfe] The return type of the setter must be 'void' or absent. - /*space*/ FutureOr set wrongReturnType2(_) {} - // ^^^^^^^^^^^^^^ + FutureOr set wrongReturnType2(_) {} + // [error column 3, length 14] // [analyzer] COMPILE_TIME_ERROR.NON_VOID_RETURN_FOR_SETTER // [cfe] The return type of the setter must be 'void' or absent. - /*space*/ Never set wrongReturnType3(_) => throw 1; - // ^^^^^ + Never set wrongReturnType3(_) => throw 1; + // [error column 3, length 5] // [analyzer] COMPILE_TIME_ERROR.NON_VOID_RETURN_FOR_SETTER // [cfe] The return type of the setter must be 'void' or absent. diff --git a/tests/language/setter/no_getter_call_runtime_test.dart b/tests/language/setter/no_getter_call_runtime_test.dart index d243de3dd1a..121c1aeec19 100644 --- a/tests/language/setter/no_getter_call_runtime_test.dart +++ b/tests/language/setter/no_getter_call_runtime_test.dart @@ -9,7 +9,6 @@ import "package:expect/expect.dart"; var topLevelClosure; - get topLevel => topLevelClosure; set topLevel(var value) {} diff --git a/tests/language/setter/no_getter_test.dart b/tests/language/setter/no_getter_test.dart index 53c8b58ba73..194d299f755 100644 --- a/tests/language/setter/no_getter_test.dart +++ b/tests/language/setter/no_getter_test.dart @@ -10,8 +10,8 @@ class Example { main() { print(topLevel++); - // ^ - // [analyzer] unspecified + // ^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER // [cfe] Getter not found: 'topLevel'. Example ex = new Example(); diff --git a/tests/language/setter/setter3_runtime_test.dart b/tests/language/setter/setter3_runtime_test.dart index 42d3d746251..64ee100ac38 100644 --- a/tests/language/setter/setter3_runtime_test.dart +++ b/tests/language/setter/setter3_runtime_test.dart @@ -12,8 +12,6 @@ class A { set foo(x) {} void set bar(x) {} - - } main() { diff --git a/tests/language/setter/setter3_test.dart b/tests/language/setter/setter3_test.dart index 59a6a7e732e..e0d6d7b3e2f 100644 --- a/tests/language/setter/setter3_test.dart +++ b/tests/language/setter/setter3_test.dart @@ -10,13 +10,13 @@ class A { set foo(x) {} void set bar(x) {} dynamic set baz(x) {} -//^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.NON_VOID_RETURN_FOR_SETTER -// [cfe] The return type of the setter must be 'void' or absent. + // [error column 3, length 7] + // [analyzer] COMPILE_TIME_ERROR.NON_VOID_RETURN_FOR_SETTER + // [cfe] The return type of the setter must be 'void' or absent. bool set bob(x) {} -//^^^^ -// [analyzer] COMPILE_TIME_ERROR.NON_VOID_RETURN_FOR_SETTER -// [cfe] The return type of the setter must be 'void' or absent. + // [error column 3, length 4] + // [analyzer] COMPILE_TIME_ERROR.NON_VOID_RETURN_FOR_SETTER + // [cfe] The return type of the setter must be 'void' or absent. } main() { diff --git a/tests/language/spread_collections/await_test.dart b/tests/language/spread_collections/await_test.dart index e540e703249..2d064d2270d 100644 --- a/tests/language/spread_collections/await_test.dart +++ b/tests/language/spread_collections/await_test.dart @@ -27,8 +27,13 @@ Future testList() async { Expect.listEquals(list, [...await future12, 3, ...await future45]); // Await in null-aware spread. - Expect.listEquals( - list, [...?await nullableFuture12, 3, ...?await futureNull, 4, 5]); + Expect.listEquals(list, [ + ...?await nullableFuture12, + 3, + ...?await futureNull, + 4, + 5, + ]); } Future testMap() async { @@ -41,8 +46,13 @@ Future testMap() async { Expect.mapEquals(map, {...await future12, 3: 3, ...await future45}); // Await in null-aware spread. - Expect.mapEquals(map, - {...?await nullableFuture12, 3: 3, ...?await futureNull, 4: 4, 5: 5}); + Expect.mapEquals(map, { + ...?await nullableFuture12, + 3: 3, + ...?await futureNull, + 4: 4, + 5: 5, + }); } Future testSet() async { @@ -55,6 +65,11 @@ Future testSet() async { Expect.setEquals(set, {...await future12, 3, ...await future45}); // Await in null-aware spread. - Expect.setEquals( - set, {...?await nullableFuture12, 3, ...?await futureNull, 4, 5}); + Expect.setEquals(set, { + ...?await nullableFuture12, + 3, + ...?await futureNull, + 4, + 5, + }); } diff --git a/tests/language/spread_collections/const_test.dart b/tests/language/spread_collections/const_test.dart index cab125ff8d7..5e57612d62d 100644 --- a/tests/language/spread_collections/const_test.dart +++ b/tests/language/spread_collections/const_test.dart @@ -22,40 +22,82 @@ void testList() { Expect.identical(list, const [...set]); // Spread at beginning. - Expect.identical(list, const [...[1, 2], 3, 4]); + Expect.identical(list, const [ + ...[1, 2], + 3, + 4, + ]); // Spread in middle. - Expect.identical(list, const [1, ...[2, 3], 4]); + Expect.identical(list, const [ + 1, + ...[2, 3], + 4, + ]); // Spread at end. - Expect.identical(list, const [1, 2, ...[3, 4]]); + Expect.identical(list, const [ + 1, + 2, + ...[3, 4], + ]); // Empty spreads. - Expect.identical(list, - const [...[], 1, 2, ...[], 3, 4, ...[]]); + Expect.identical(list, const [ + ...[], + 1, + 2, + ...[], + 3, + 4, + ...[], + ]); // Multiple spreads. - Expect.identical(list, - const [...[1], 2, ...[3, 4]]); + Expect.identical(list, const [ + ...[1], + 2, + ...[3, 4], + ]); // Nested spreads. - Expect.identical(list, - const [...[...[1, 2], ...[3, 4]]]); + Expect.identical(list, const [ + ...[ + ...[1, 2], + ...[3, 4], + ], + ]); // Null-aware. const list23 = [2, 3] as List?; const list4 = [4] as List?; - Expect.identical(list, - const [1, ...?list23, ...?(null), ...?list4]); + Expect.identical(list, const [1, ...?list23, ...?(null), ...?list4]); // Does not deep flatten. Expect.identical( - const [1, 2, [3], 4], - const [1, ...[2, [3], 4]]); + const [ + 1, + 2, + [3], + 4, + ], + const [ + 1, + ...[ + 2, + [3], + 4, + ], + ], + ); // Establishes const context. - Expect.identical(const [Symbol("sym")], - const [...[Symbol("sym")]]); + Expect.identical( + const [Symbol("sym")], + const [ + ...[Symbol("sym")], + ], + ); } void testMap() { @@ -63,16 +105,25 @@ void testMap() { Expect.identical(map, const {...map}); // Spread at beginning. - Expect.identical(map, - const {...{1: 1, 2: 2}, 3: 3, 4: 4}); + Expect.identical(map, const { + ...{1: 1, 2: 2}, + 3: 3, + 4: 4, + }); // Spread in middle. - Expect.identical(map, - const {1: 1, ...{2: 2, 3: 3}, 4: 4}); + Expect.identical(map, const { + 1: 1, + ...{2: 2, 3: 3}, + 4: 4, + }); // Spread at end. - Expect.identical(map, - const {1: 1, 2: 2, ...{3: 3, 4: 4}}); + Expect.identical(map, const { + 1: 1, + 2: 2, + ...{3: 3, 4: 4}, + }); // Empty spreads. Expect.identical(map, const { @@ -82,19 +133,22 @@ void testMap() { ...{}, 3: 3, 4: 4, - ...{} + ...{}, }); // Multiple spreads. - Expect.identical(map, - const {...{1: 1}, 2: 2, ...{3: 3, 4: 4}}); + Expect.identical(map, const { + ...{1: 1}, + 2: 2, + ...{3: 3, 4: 4}, + }); // Nested spreads. Expect.identical(map, const { ...{ ...{1: 1, 2: 2}, - ...{3: 3, 4: 4} - } + ...{3: 3, 4: 4}, + }, }); // Null-aware. @@ -104,30 +158,34 @@ void testMap() { 1: 1, ...?map23, ...?(null), - ...?map4 + ...?map4, }); // Does not deep flatten. - Expect.identical(const { - 1: 1, - 2: 2, - 3: {3: 3}, - 4: 4 - }, const { - 1: 1, - ...{ + Expect.identical( + const { + 1: 1, 2: 2, 3: {3: 3}, - 4: 4 - } - }); + 4: 4, + }, + const { + 1: 1, + ...{ + 2: 2, + 3: {3: 3}, + 4: 4, + }, + }, + ); // Establishes const context. - Expect.identical(const { - Symbol("sym"): Symbol("bol") - }, const { - ...{Symbol("sym"): Symbol("bol")} - }); + Expect.identical( + const {Symbol("sym"): Symbol("bol")}, + const { + ...{Symbol("sym"): Symbol("bol")}, + }, + ); } void testSet() { @@ -136,51 +194,123 @@ void testSet() { Expect.identical(set, const {...list}); // Spread at beginning. - Expect.identical(set, const {...[1, 2], 3, 4}); + Expect.identical(set, const { + ...[1, 2], + 3, + 4, + }); // Spread in middle. - Expect.identical(set, const {1, ...[2, 3], 4}); + Expect.identical(set, const { + 1, + ...[2, 3], + 4, + }); // Spread at end. - Expect.identical(set, const {1, 2, ...[3, 4]}); + Expect.identical(set, const { + 1, + 2, + ...[3, 4], + }); // Empty spreads. - Expect.identical(set, - const {...[], 1, 2, ...[], 3, 4, ...[]}); + Expect.identical(set, const { + ...[], + 1, + 2, + ...[], + 3, + 4, + ...[], + }); // Multiple spreads. - Expect.identical(set, const {...[1], 2, ...[3, 4]}); + Expect.identical(set, const { + ...[1], + 2, + ...[3, 4], + }); // Nested spreads. - Expect.identical(set, const {...{...[1, 2], ...[3, 4]}}); + Expect.identical(set, const { + ...{ + ...[1, 2], + ...[3, 4], + }, + }); // Null-aware. const list23 = [2, 3] as List?; const list4 = [4] as List?; - Expect.identical(set, - const {1, ...?list23, ...?(null), ...?list4}); + Expect.identical(set, const {1, ...?list23, ...?(null), ...?list4}); // Does not deep flatten. - Expect.identical(const {1, 2, {3}, 4}, - const {1, ...{2, {3}, 4}}); + Expect.identical( + const { + 1, + 2, + {3}, + 4, + }, + const { + 1, + ...{ + 2, + {3}, + 4, + }, + }, + ); // Establishes const context. - Expect.identical(const {Symbol("sym")}, - const {...{Symbol("sym")}}); + Expect.identical( + const {Symbol("sym")}, + const { + ...{Symbol("sym")}, + }, + ); } void testKeyOrder() { // Canonicalization isn't affected by which elements are spread. - Expect.identical(map, - const {1: 1, ...{2: 2, 3: 3}, 4: 4}); - Expect.identical(map, - const {1: 1, ...{2: 2}, 3: 3, ...{4: 4}}); + Expect.identical(map, const { + 1: 1, + ...{2: 2, 3: 3}, + 4: 4, + }); + Expect.identical(map, const { + 1: 1, + ...{2: 2}, + 3: 3, + ...{4: 4}, + }); - Expect.identical(set, const {1, ...{2, 3}, 4}); - Expect.identical(set, const {1, ...{2}, 3, ...{4}}); + Expect.identical(set, const { + 1, + ...{2, 3}, + 4, + }); + Expect.identical(set, const { + 1, + ...{2}, + 3, + ...{4}, + }); // Ordering does affect canonicalization. - Expect.notIdentical(const {1: 1, 2: 2, 3: 3}, - const {1: 1, ...{3: 3, 2: 2}}); - Expect.notIdentical(const {1, 2, 3}, const {1, ...{3, 2}}); + Expect.notIdentical( + const {1: 1, 2: 2, 3: 3}, + const { + 1: 1, + ...{3: 3, 2: 2}, + }, + ); + Expect.notIdentical( + const {1, 2, 3}, + const { + 1, + ...{3, 2}, + }, + ); } diff --git a/tests/language/spread_collections/helper_classes.dart b/tests/language/spread_collections/helper_classes.dart index 3e10706a78f..d7a0322285e 100644 --- a/tests/language/spread_collections/helper_classes.dart +++ b/tests/language/spread_collections/helper_classes.dart @@ -39,9 +39,11 @@ class ConstMap implements Map { String? remove(Object? key) => throw UnsupportedError("unsupported"); void removeWhere(bool Function(int key, String value) predicate) => throw UnsupportedError("unsupported"); - String update(int key, String Function(String value) update, - {String Function()? ifAbsent}) => - throw UnsupportedError("unsupported"); + String update( + int key, + String Function(String value) update, { + String Function()? ifAbsent, + }) => throw UnsupportedError("unsupported"); void updateAll(String Function(int key, String value) update) => throw UnsupportedError("unsupported"); } diff --git a/tests/language/spread_collections/inference_test.dart b/tests/language/spread_collections/inference_test.dart index c0dff363b47..02598598387 100644 --- a/tests/language/spread_collections/inference_test.dart +++ b/tests/language/spread_collections/inference_test.dart @@ -14,37 +14,97 @@ void testBottomUpInference() { // Lists. Expect.type>([...[]]); Expect.type>([...[]]); - Expect.type>([...[1]]); - Expect.type>([1, ...[2]]); - Expect.type>([1, ...[0.2]]); - Expect.type>([...[1, 2]]); - Expect.type>([...[1, 0.2]]); - Expect.type>([...[1], ...[2]]); - Expect.type>([...[1], ...[0.2]]); + Expect.type>([ + ...[1], + ]); + Expect.type>([ + 1, + ...[2], + ]); + Expect.type>([ + 1, + ...[0.2], + ]); + Expect.type>([ + ...[1, 2], + ]); + Expect.type>([ + ...[1, 0.2], + ]); + Expect.type>([ + ...[1], + ...[2], + ]); + Expect.type>([ + ...[1], + ...[0.2], + ]); // Maps. Expect.type>({...{}}); Expect.type>({...{}}); - Expect.type>({...{1: 1}}); - Expect.type>({1: 1, ...{2: 2}}); - Expect.type>({1: 1, ...{0.2: 0.2}}); - Expect.type>({...{1: 1, 2: 2}}); - Expect.type>({...{1: 1, 0.2: 0.2}}); - Expect.type>({...{1: 1}, ...{2: 2}}); - Expect.type>({...{1: 1}, ...{0.2: 0.2}}); + Expect.type>({ + ...{1: 1}, + }); + Expect.type>({ + 1: 1, + ...{2: 2}, + }); + Expect.type>({ + 1: 1, + ...{0.2: 0.2}, + }); + Expect.type>({ + ...{1: 1, 2: 2}, + }); + Expect.type>({ + ...{1: 1, 0.2: 0.2}, + }); + Expect.type>({ + ...{1: 1}, + ...{2: 2}, + }); + Expect.type>({ + ...{1: 1}, + ...{0.2: 0.2}, + }); // Sets. Expect.type>({...[]}); Expect.type>({...[]}); - Expect.type>({...[1]}); - Expect.type>({1, ...[2]}); - Expect.type>({1, ...[0.2]}); - Expect.type>({...[1, 2]}); - Expect.type>({...[1, 0.2]}); - Expect.type>({...[1], ...[2]}); - Expect.type>({...[1], ...[0.2]}); - Expect.type>({...{1}, ...[0.2]}); - Expect.type>({...{1}, ...{0.2}}); + Expect.type>({ + ...[1], + }); + Expect.type>({ + 1, + ...[2], + }); + Expect.type>({ + 1, + ...[0.2], + }); + Expect.type>({ + ...[1, 2], + }); + Expect.type>({ + ...[1, 0.2], + }); + Expect.type>({ + ...[1], + ...[2], + }); + Expect.type>({ + ...[1], + ...[0.2], + }); + Expect.type>({ + ...{1}, + ...[0.2], + }); + Expect.type>({ + ...{1}, + ...{0.2}, + }); // If the iterable's type is dynamic, the element type is inferred as dynamic. Expect.type>([...([] as dynamic)]); @@ -92,8 +152,10 @@ void testTopDownInference() { Expect.mapEquals({}, {...expectIntStringMap()}); // Bottom up-inference from elements is not pushed back down into spread. - Expect.mapEquals({1: "s"}, - {1: "s", ...expectDynamicDynamicMap()}); + Expect.mapEquals( + {1: "s"}, + {1: "s", ...expectDynamicDynamicMap()}, + ); // Sets. Set expectIntSet() { diff --git a/tests/language/spread_collections/issue_45174_error_test.dart b/tests/language/spread_collections/issue_45174_error_test.dart index 377498c5331..55adb3c45a6 100644 --- a/tests/language/spread_collections/issue_45174_error_test.dart +++ b/tests/language/spread_collections/issue_45174_error_test.dart @@ -8,7 +8,6 @@ f(Object? objectQuestion) { // [analyzer] COMPILE_TIME_ERROR.AMBIGUOUS_SET_OR_MAP_LITERAL_EITHER // ^^^^^^^^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE - // ^ // [cfe] Unexpected type 'Object?' of a map spread entry. Expected 'dynamic' or a Map. } diff --git a/tests/language/spread_collections/null_spread_context_test.dart b/tests/language/spread_collections/null_spread_context_test.dart index 63cba554e8a..b3f16844221 100644 --- a/tests/language/spread_collections/null_spread_context_test.dart +++ b/tests/language/spread_collections/null_spread_context_test.dart @@ -11,27 +11,28 @@ import 'package:expect/static_type_helper.dart'; main() { { List notNullAware = [ - ...(contextType([])..expectStaticType>>()) + ...(contextType([])..expectStaticType>>()), ]; List nullAware = [ - ...?(contextType([])..expectStaticType?>>()) + ...?(contextType([])..expectStaticType?>>()), ]; } { Set notNullAware = { - ...(contextType([])..expectStaticType>>()) + ...(contextType([])..expectStaticType>>()), }; Set nullAware = { - ...?(contextType([])..expectStaticType?>>()) + ...?(contextType([])..expectStaticType?>>()), }; } { Map notNullAware = { - ...(contextType({})..expectStaticType>>()) + ...(contextType({}) + ..expectStaticType>>()), }; Map nullAware = { ...?(contextType({}) - ..expectStaticType?>>()) + ..expectStaticType?>>()), }; } } diff --git a/tests/language/spread_collections/spread_test.dart b/tests/language/spread_collections/spread_test.dart index baee04c3a87..de20d749e37 100644 --- a/tests/language/spread_collections/spread_test.dart +++ b/tests/language/spread_collections/spread_test.dart @@ -24,23 +24,51 @@ void testList() { Expect.listEquals(list, [...list]); // Spread at beginning. - Expect.listEquals(list, [...[1, 2], 3, 4]); + Expect.listEquals(list, [ + ...[1, 2], + 3, + 4, + ]); // Spread in middle. - Expect.listEquals(list, [1, ...[2, 3], 4]); + Expect.listEquals(list, [ + 1, + ...[2, 3], + 4, + ]); // Spread at end. - Expect.listEquals(list, [1, 2, ...[3, 4]]); + Expect.listEquals(list, [ + 1, + 2, + ...[3, 4], + ]); // Empty spreads. - Expect.listEquals(list, - [...[], 1, 2, ...[], 3, 4, ...[]]); + Expect.listEquals(list, [ + ...[], + 1, + 2, + ...[], + 3, + 4, + ...[], + ]); // Multiple spreads. - Expect.listEquals(list, [...[1], 2, ...[3, 4]]); + Expect.listEquals(list, [ + ...[1], + 2, + ...[3, 4], + ]); // Nested spreads. - Expect.listEquals(list, [...[...[1, 2], ...[3, 4]]]); + Expect.listEquals(list, [ + ...[ + ...[1, 2], + ...[3, 4], + ], + ]); // Null-aware. var list23 = [2, 3] as List?; @@ -50,11 +78,17 @@ void testList() { // Does not deep flatten. var innerList = [3]; Expect.listEquals( - [1, 2, innerList, 4], - [1, ...[2, innerList, 4]]); + [1, 2, innerList, 4], + [ + 1, + ...[2, innerList, 4], + ], + ); // Downcast element from dynamic. - Expect.listEquals(list, [...[1, 2, 3, 4]]); + Expect.listEquals(list, [ + ...[1, 2, 3, 4], + ]); } void testMap() { @@ -62,13 +96,25 @@ void testMap() { Expect.mapEquals(map, {...map}); // Spread at beginning. - Expect.mapEquals(map, {...{1: 1, 2: 2}, 3: 3, 4: 4}); + Expect.mapEquals(map, { + ...{1: 1, 2: 2}, + 3: 3, + 4: 4, + }); // Spread in middle. - Expect.mapEquals(map, {1: 1, ...{2: 2, 3: 3}, 4: 4}); + Expect.mapEquals(map, { + 1: 1, + ...{2: 2, 3: 3}, + 4: 4, + }); // Spread at end. - Expect.mapEquals(map, {1: 1, 2: 2, ...{3: 3, 4: 4}}); + Expect.mapEquals(map, { + 1: 1, + 2: 2, + ...{3: 3, 4: 4}, + }); // Empty spreads. Expect.mapEquals(map, { @@ -78,50 +124,43 @@ void testMap() { ...{}, 3: 3, 4: 4, - ...{} + ...{}, }); // Multiple spreads. - Expect.mapEquals(map, - {...{1: 1}, 2: 2, ...{3: 3, 4: 4}}); + Expect.mapEquals(map, { + ...{1: 1}, + 2: 2, + ...{3: 3, 4: 4}, + }); // Nested spreads. Expect.mapEquals(map, { ...{ ...{1: 1, 2: 2}, - ...{3: 3, 4: 4} - } + ...{3: 3, 4: 4}, + }, }); // Null-aware. var map23 = {2: 2, 3: 3} as Map?; var map4 = {4: 4} as Map?; - Expect.mapEquals(map, { - 1: 1, - ...?map23, - ...?(null), - ...?map4 - }); + Expect.mapEquals(map, {1: 1, ...?map23, ...?(null), ...?map4}); // Does not deep flatten. var innerMap = {3: 3}; - Expect.mapEquals({ - 1: 1, - 2: 2, - 3: innerMap, - 4: 4 - }, { - 1: 1, - ...{ - 2: 2, - 3: innerMap, - 4: 4 - } - }); + Expect.mapEquals( + {1: 1, 2: 2, 3: innerMap, 4: 4}, + { + 1: 1, + ...{2: 2, 3: innerMap, 4: 4}, + }, + ); // Downcast element from dynamic. - Expect.mapEquals( - map, {...{1: 1, 2: 2, 3: 3, 4: 4}}); + Expect.mapEquals(map, { + ...{1: 1, 2: 2, 3: 3, 4: 4}, + }); } void testSet() { @@ -129,22 +168,43 @@ void testSet() { Expect.setEquals(set, {...set}); // Spread at beginning. - Expect.setEquals(set, {...[1, 2], 3, 4}); + Expect.setEquals(set, { + ...[1, 2], + 3, + 4, + }); // Spread in middle. - Expect.setEquals(set, {1, ...[2, 3], 4}); + Expect.setEquals(set, { + 1, + ...[2, 3], + 4, + }); // Spread at end. - Expect.setEquals(set, {1, 2, ...[3, 4]}); + Expect.setEquals(set, { + 1, + 2, + ...[3, 4], + }); // Empty spreads. Expect.setEquals(set, {...[], 1, 2, ...[], 3, 4, ...[]}); // Multiple spreads. - Expect.setEquals(set, {...[1], 2, ...[3, 4]}); + Expect.setEquals(set, { + ...[1], + 2, + ...[3, 4], + }); // Nested spreads. - Expect.setEquals(set, {...{...[1, 2], ...[3, 4]}}); + Expect.setEquals(set, { + ...{ + ...[1, 2], + ...[3, 4], + }, + }); // Null-aware. var list23 = [2, 3] as List?; @@ -153,11 +213,18 @@ void testSet() { // Does not deep flatten. var innerSet = {3}; - Expect.setEquals({1, 2, innerSet, 4}, - {1, ...[2, innerSet, 4]}); + Expect.setEquals( + {1, 2, innerSet, 4}, + { + 1, + ...[2, innerSet, 4], + }, + ); // Downcast element from dynamic. - Expect.setEquals(set, {...[1, 2, 3, 4]}); + Expect.setEquals(set, { + ...[1, 2, 3, 4], + }); } void testDuplicateKeys() { @@ -166,9 +233,15 @@ void testDuplicateKeys() { 2: 2, ...{2: 2, 3: 3, 4: 4}, ...{3: 3}, - 4: 4 + 4: 4, + }); + Expect.setEquals(set, { + 1, + 2, + ...[1, 2, 3, 4], + ...[2, 3], + 4, }); - Expect.setEquals(set, {1, 2, ...[1, 2, 3, 4], ...[2, 3], 4}); } void testKeyOrder() { @@ -178,10 +251,16 @@ void testKeyOrder() { var e2a = Equality(2, "a"); var e2b = Equality(2, "b"); - var map = {e1a: 1, ...{e1b: 2, e2a: 3, e2b: 4}}; + var map = { + e1a: 1, + ...{e1b: 2, e2a: 3, e2b: 4}, + }; Expect.equals("1:a,2:a", map.keys.join(",")); - var set = {e1a, ...[e1b, e2a, e2b]}; + var set = { + e1a, + ...[e1b, e2a, e2b], + }; Expect.equals("1:a,2:a", set.join(",")); // All elements are evaluated, left to right. @@ -193,11 +272,14 @@ void testKeyOrder() { map = { log(e1a): log(1), - ...{log(e1b): log(2), log(e2a): log(3), log(e2b): log(4)} + ...{log(e1b): log(2), log(e2a): log(3), log(e2b): log(4)}, }; Expect.equals("1:a,1,1:b,2,2:a,3,2:b,4", transcript.join(",")); transcript.clear(); - set = {log(e1a), ...[log(e1b), log(e2a), log(e2b)]}; + set = { + log(e1a), + ...[log(e1b), log(e2a), log(e2b)], + }; Expect.equals("1:a,1:b,2:a,2:b", transcript.join(",")); } diff --git a/tests/language/spread_collections/syntax_test.dart b/tests/language/spread_collections/syntax_test.dart index ed6676feaf3..43e67d8c635 100644 --- a/tests/language/spread_collections/syntax_test.dart +++ b/tests/language/spread_collections/syntax_test.dart @@ -7,16 +7,45 @@ import 'package:expect/expect.dart'; void main() { // Trailing comma. - Expect.listEquals([1, 2], [...[1, 2],]); - Expect.mapEquals({1: 1, 2: 2}, {...{1: 1, 2: 2},}); - Expect.setEquals({1, 2}, {...{1, 2},}); + Expect.listEquals( + [1, 2], + [ + ...[1, 2], + ], + ); + Expect.mapEquals( + {1: 1, 2: 2}, + { + ...{1: 1, 2: 2}, + }, + ); + Expect.setEquals( + {1, 2}, + { + ...{1, 2}, + }, + ); // Precedence. - Expect.listEquals([1, 2, 3], [1, ...true ? [2] : [], 3]); + Expect.listEquals( + [1, 2, 3], + [ + 1, + ...true ? [2] : [], + 3, + ], + ); Expect.listEquals([1, 3], [1, ...?true ? null : [], 3]); var a = [0]; - Expect.listEquals([1, 2, 3], [1, ...a = [2], 3]); + Expect.listEquals( + [1, 2, 3], + [ + 1, + ...a = [2], + 3, + ], + ); var nullableA = [0] as List?; Expect.listEquals([1, 3], [1, ...?nullableA = null, 3]); diff --git a/tests/language/static/call_wrong_argument_count_test.dart b/tests/language/static/call_wrong_argument_count_test.dart index ca34e7cd1ad..b101845dce2 100644 --- a/tests/language/static/call_wrong_argument_count_test.dart +++ b/tests/language/static/call_wrong_argument_count_test.dart @@ -13,8 +13,8 @@ main() { Niesen.goodCall(1, 2, 3); Niesen.goodCall(1, 2, 3, 4); + // ^ + // [cfe] Too many positional arguments: 3 allowed, but 4 found. // ^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS - // ^^^^^^^^^^^^ - // [cfe] Too many positional arguments: 3 allowed, but 4 found. } diff --git a/tests/language/static/const_field_test.dart b/tests/language/static/const_field_test.dart index 2a6547e9c39..6c860992a09 100644 --- a/tests/language/static/const_field_test.dart +++ b/tests/language/static/const_field_test.dart @@ -30,10 +30,7 @@ class A implements Switzerland { static const artist2 = Switzerland.AG; static const architect1 = Spain.AG; static const array1 = const [1, 2]; - static const map1 = const { - "Monday": 1, - "Tuesday": 2, - }; + static const map1 = const {"Monday": 1, "Tuesday": 2}; } class StaticFinalFieldTest { diff --git a/tests/language/static/field1_runtime_test.dart b/tests/language/static/field1_runtime_test.dart index 6db193e03e1..1c30475b635 100644 --- a/tests/language/static/field1_runtime_test.dart +++ b/tests/language/static/field1_runtime_test.dart @@ -15,7 +15,6 @@ class StaticField1Test { static testMain() { if (false) { var foo = new Foo(); - } } } diff --git a/tests/language/static/field1a_runtime_test.dart b/tests/language/static/field1a_runtime_test.dart index 1f6b79869f4..2675130a64d 100644 --- a/tests/language/static/field1a_runtime_test.dart +++ b/tests/language/static/field1a_runtime_test.dart @@ -15,7 +15,6 @@ class StaticField1aTest { static testMain() { if (false) { var foo = new Foo(); - } } } diff --git a/tests/language/static/field3_runtime_test.dart b/tests/language/static/field3_runtime_test.dart index d2c9f3ad7c7..65c126482fe 100644 --- a/tests/language/static/field3_runtime_test.dart +++ b/tests/language/static/field3_runtime_test.dart @@ -13,10 +13,5 @@ class Foo { } main() { - if (false) { - - - - - } + if (false) {} } diff --git a/tests/language/static/final_field2_runtime_test.dart b/tests/language/static/final_field2_runtime_test.dart index b69448d52e0..7711ec8c2cb 100644 --- a/tests/language/static/final_field2_runtime_test.dart +++ b/tests/language/static/final_field2_runtime_test.dart @@ -18,8 +18,6 @@ class B { } main() { - new B(); print(B.b); - } diff --git a/tests/language/static/final_field2_test.dart b/tests/language/static/final_field2_test.dart index da8ea37b4d7..fb6721d2127 100644 --- a/tests/language/static/final_field2_test.dart +++ b/tests/language/static/final_field2_test.dart @@ -19,9 +19,9 @@ class B { main() { A.x = 2; -// ^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_CONST -// [cfe] Setter not found: 'x'. + //^ + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_CONST + // [cfe] Setter not found: 'x'. new B(); print(B.b); print(B.a); diff --git a/tests/language/static/getter_no_setter1_runtime_test.dart b/tests/language/static/getter_no_setter1_runtime_test.dart index 13567dbc3d3..d0f0e7f0517 100644 --- a/tests/language/static/getter_no_setter1_runtime_test.dart +++ b/tests/language/static/getter_no_setter1_runtime_test.dart @@ -10,9 +10,7 @@ import 'package:expect/expect.dart'; class Class { static int get getter => 0; - method() { - - } + method() {} } main() { diff --git a/tests/language/static/getter_no_setter1_test.dart b/tests/language/static/getter_no_setter1_test.dart index dd307ece7ec..975d69419b5 100644 --- a/tests/language/static/getter_no_setter1_test.dart +++ b/tests/language/static/getter_no_setter1_test.dart @@ -9,9 +9,9 @@ class Class { method() { getter++; -// ^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER -// [cfe] Setter not found: 'getter'. + // [error column 5, length 6] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER + // [cfe] Setter not found: 'getter'. } } diff --git a/tests/language/static/getter_no_setter2_runtime_test.dart b/tests/language/static/getter_no_setter2_runtime_test.dart index 82663cb0bc4..a7374278011 100644 --- a/tests/language/static/getter_no_setter2_runtime_test.dart +++ b/tests/language/static/getter_no_setter2_runtime_test.dart @@ -10,9 +10,7 @@ import 'package:expect/expect.dart'; class Class { static int get getter => 0; - method() { - - } + method() {} noSuchMethod(i) => 42; } diff --git a/tests/language/static/getter_no_setter2_test.dart b/tests/language/static/getter_no_setter2_test.dart index e84b2b852ff..eb424342152 100644 --- a/tests/language/static/getter_no_setter2_test.dart +++ b/tests/language/static/getter_no_setter2_test.dart @@ -9,9 +9,9 @@ class Class { method() { getter++; -// ^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER -// [cfe] Setter not found: 'getter'. + // [error column 5, length 6] + // [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_NO_SETTER + // [cfe] Setter not found: 'getter'. } noSuchMethod(i) => 42; diff --git a/tests/language/static/setter_get_runtime_test.dart b/tests/language/static/setter_get_runtime_test.dart index b04380c8d1d..dcf6349b053 100644 --- a/tests/language/static/setter_get_runtime_test.dart +++ b/tests/language/static/setter_get_runtime_test.dart @@ -13,6 +13,4 @@ class Class { noSuchMethod(_) => 42; } -main() { - -} +main() {} diff --git a/tests/language/static/top_level_runtime_test.dart b/tests/language/static/top_level_runtime_test.dart index 0c0b8ce487e..950b440b220 100644 --- a/tests/language/static/top_level_runtime_test.dart +++ b/tests/language/static/top_level_runtime_test.dart @@ -5,14 +5,4 @@ // 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. - - - - - - - - - - void main() {} diff --git a/tests/language/static/top_level_test.dart b/tests/language/static/top_level_test.dart index 8d788cf6dc9..b0b577c46f0 100644 --- a/tests/language/static/top_level_test.dart +++ b/tests/language/static/top_level_test.dart @@ -3,36 +3,36 @@ // BSD-style license that can be found in the LICENSE file. static method() { } -// [error line 5, column 1, length 6] +// [error column 1, length 6] // [analyzer] SYNTACTIC_ERROR.EXTRANEOUS_MODIFIER // [cfe] Can't have modifier 'static' here. static var field; -// [error line 9, column 1, length 6] +// [error column 1, length 6] // [analyzer] SYNTACTIC_ERROR.EXTRANEOUS_MODIFIER // [cfe] Can't have modifier 'static' here. static const finalField = 42; -// [error line 13, column 1, length 6] +// [error column 1, length 6] // [analyzer] SYNTACTIC_ERROR.EXTRANEOUS_MODIFIER // [cfe] Can't have modifier 'static' here. static const constant = 123; -// [error line 17, column 1, length 6] +// [error column 1, length 6] // [analyzer] SYNTACTIC_ERROR.EXTRANEOUS_MODIFIER // [cfe] Can't have modifier 'static' here. static int typedMethod() => 87; -// [error line 22, column 1, length 6] +// [error column 1, length 6] // [analyzer] SYNTACTIC_ERROR.EXTRANEOUS_MODIFIER // [cfe] Can't have modifier 'static' here. static int typedField = -1; -// [error line 26, column 1, length 6] +// [error column 1, length 6] // [analyzer] SYNTACTIC_ERROR.EXTRANEOUS_MODIFIER // [cfe] Can't have modifier 'static' here. static const int typedFinalField = 99; -// [error line 30, column 1, length 6] +// [error column 1, length 6] // [analyzer] SYNTACTIC_ERROR.EXTRANEOUS_MODIFIER // [cfe] Can't have modifier 'static' here. static const int typedConstant = 1; -// [error line 34, column 1, length 6] +// [error column 1, length 6] // [analyzer] SYNTACTIC_ERROR.EXTRANEOUS_MODIFIER // [cfe] Can't have modifier 'static' here. diff --git a/tests/language/string/adjacent_const_string_literals_test.dart b/tests/language/string/adjacent_const_string_literals_test.dart index 0af09ba311b..e7cde2208dd 100644 --- a/tests/language/string/adjacent_const_string_literals_test.dart +++ b/tests/language/string/adjacent_const_string_literals_test.dart @@ -21,97 +21,310 @@ main() { } testEmpty() { - Expect.equals("", (const Conster("" "" "")).toString()); - Expect.equals("", (const Conster("" '' "")).toString()); - Expect.equals("", (const Conster("" "" r"")).toString()); + Expect.equals( + "", + (const Conster( + "" + "" + "", + )).toString(), + ); + Expect.equals( + "", + (const Conster( + "" + '' + "", + )).toString(), + ); + Expect.equals( + "", + (const Conster( + "" + "" + r"", + )).toString(), + ); - Expect.equals("a", (const Conster("a" "")).toString()); - Expect.equals("a", (const Conster("a" '')).toString()); - Expect.equals("a", (const Conster("a" r'')).toString()); + Expect.equals( + "a", + (const Conster( + "a" + "", + )).toString(), + ); + Expect.equals( + "a", + (const Conster( + "a" + '', + )).toString(), + ); + Expect.equals( + "a", + (const Conster( + "a" + r'', + )).toString(), + ); - Expect.equals("b", (const Conster('b' "")).toString()); - Expect.equals("b", (const Conster('b' '')).toString()); - Expect.equals("b", (const Conster('b' r'')).toString()); + Expect.equals( + "b", + (const Conster( + 'b' + "", + )).toString(), + ); + Expect.equals( + "b", + (const Conster( + 'b' + '', + )).toString(), + ); + Expect.equals( + "b", + (const Conster( + 'b' + r'', + )).toString(), + ); - Expect.equals("c", (const Conster(r'c' "")).toString()); - Expect.equals("c", (const Conster(r'c' '')).toString()); - Expect.equals("c", (const Conster(r'c' r'')).toString()); + Expect.equals( + "c", + (const Conster( + r'c' + "", + )).toString(), + ); + Expect.equals( + "c", + (const Conster( + r'c' + '', + )).toString(), + ); + Expect.equals( + "c", + (const Conster( + r'c' + r'', + )).toString(), + ); - Expect.equals("a", (const Conster("" "a")).toString()); - Expect.equals("a", (const Conster("" 'a')).toString()); - Expect.equals("a", (const Conster("" r'a')).toString()); + Expect.equals( + "a", + (const Conster( + "" + "a", + )).toString(), + ); + Expect.equals( + "a", + (const Conster( + "" + 'a', + )).toString(), + ); + Expect.equals( + "a", + (const Conster( + "" + r'a', + )).toString(), + ); - Expect.equals("b", (const Conster('' "b")).toString()); - Expect.equals("b", (const Conster('' 'b')).toString()); - Expect.equals("b", (const Conster('' r'b')).toString()); + Expect.equals( + "b", + (const Conster( + '' + "b", + )).toString(), + ); + Expect.equals( + "b", + (const Conster( + '' + 'b', + )).toString(), + ); + Expect.equals( + "b", + (const Conster( + '' + r'b', + )).toString(), + ); - Expect.equals("c", (const Conster(r'' "c")).toString()); - Expect.equals("c", (const Conster(r'' 'c')).toString()); - Expect.equals("c", (const Conster(r'' r'c')).toString()); + Expect.equals( + "c", + (const Conster( + r'' + "c", + )).toString(), + ); + Expect.equals( + "c", + (const Conster( + r'' + 'c', + )).toString(), + ); + Expect.equals( + "c", + (const Conster( + r'' + r'c', + )).toString(), + ); } const s = "a"; testInterpolation() { - Expect.equals(r"ab", (const Conster("$s" "b")).toString()); - Expect.equals(r"ab", (const Conster('$s' "b")).toString()); - Expect.equals(r"$sb", (const Conster(r'$s' "b")).toString()); + Expect.equals( + r"ab", + (const Conster( + "$s" + "b", + )).toString(), + ); + Expect.equals( + r"ab", + (const Conster( + '$s' + "b", + )).toString(), + ); + Expect.equals( + r"$sb", + (const Conster( + r'$s' + "b", + )).toString(), + ); - Expect.equals(r"-a-b", (const Conster("-$s-" "b")).toString()); - Expect.equals(r"-a-b", (const Conster('-$s-' "b")).toString()); - Expect.equals(r"-$s-b", (const Conster(r'-$s-' "b")).toString()); + Expect.equals( + r"-a-b", + (const Conster( + "-$s-" + "b", + )).toString(), + ); + Expect.equals( + r"-a-b", + (const Conster( + '-$s-' + "b", + )).toString(), + ); + Expect.equals( + r"-$s-b", + (const Conster( + r'-$s-' + "b", + )).toString(), + ); - Expect.equals(r"ba", (const Conster('b' "$s")).toString()); - Expect.equals(r"ba", (const Conster('b' '$s')).toString()); - Expect.equals(r"b$s", (const Conster('b' r'$s')).toString()); + Expect.equals( + r"ba", + (const Conster( + 'b' + "$s", + )).toString(), + ); + Expect.equals( + r"ba", + (const Conster( + 'b' + '$s', + )).toString(), + ); + Expect.equals( + r"b$s", + (const Conster( + 'b' + r'$s', + )).toString(), + ); - Expect.equals(r"b-a-", (const Conster('b' "-$s-")).toString()); - Expect.equals(r"b-a-", (const Conster('b' '-$s-')).toString()); - Expect.equals(r"b-$s-", (const Conster('b' r'-$s-')).toString()); + Expect.equals( + r"b-a-", + (const Conster( + 'b' + "-$s-", + )).toString(), + ); + Expect.equals( + r"b-a-", + (const Conster( + 'b' + '-$s-', + )).toString(), + ); + Expect.equals( + r"b-$s-", + (const Conster( + 'b' + r'-$s-', + )).toString(), + ); } testMultiline() { Expect.equals( - "abe", - (const Conster("a" - "b" - "e")) - .toString()); + "abe", + (const Conster( + "a" + "b" + "e", + )).toString(), + ); Expect.equals( - "a b e", - (const Conster("a " - "b " - "e")) - .toString()); + "a b e", + (const Conster( + "a " + "b " + "e", + )).toString(), + ); Expect.equals( - "a b e", - (const Conster("a" - " b" - " e")) - .toString()); + "a b e", + (const Conster( + "a" + " b" + " e", + )).toString(), + ); Expect.equals( - "abe", - (const Conster(""" + "abe", + (const Conster( + """ a""" - "b" - "e")) - .toString()); + "b" + "e", + )).toString(), + ); Expect.equals( - "a b e", - (const Conster(""" + "a b e", + (const Conster( + """ a""" - " b" - " e")) - .toString()); + " b" + " e", + )).toString(), + ); Expect.equals( - "abe", - (const Conster(""" + "abe", + (const Conster( + """ a""" - """ + """ b""" - """ -e""")) - .toString()); + """ +e""", + )).toString(), + ); } diff --git a/tests/language/string/adjacent_string_literals_test.dart b/tests/language/string/adjacent_string_literals_test.dart index 48f8ba2bd1c..33ad9af1baf 100644 --- a/tests/language/string/adjacent_string_literals_test.dart +++ b/tests/language/string/adjacent_string_literals_test.dart @@ -11,90 +11,231 @@ main() { } testEmpty() { - Expect.equals("", "" "" ""); - Expect.equals("", "" '' ""); - Expect.equals("", "" "" r""); + Expect.equals( + "", + "" + "" + "", + ); + Expect.equals( + "", + "" + '' + "", + ); + Expect.equals( + "", + "" + "" + r"", + ); - Expect.equals("a", "a" ""); - Expect.equals("a", "a" ''); - Expect.equals("a", "a" r''); + Expect.equals( + "a", + "a" + "", + ); + Expect.equals( + "a", + "a" + '', + ); + Expect.equals( + "a", + "a" + r'', + ); - Expect.equals("b", 'b' ""); - Expect.equals("b", 'b' ''); - Expect.equals("b", 'b' r''); + Expect.equals( + "b", + 'b' + "", + ); + Expect.equals( + "b", + 'b' + '', + ); + Expect.equals( + "b", + 'b' + r'', + ); - Expect.equals("c", r'c' ""); - Expect.equals("c", r'c' ''); - Expect.equals("c", r'c' r''); + Expect.equals( + "c", + r'c' + "", + ); + Expect.equals( + "c", + r'c' + '', + ); + Expect.equals( + "c", + r'c' + r'', + ); - Expect.equals("a", "" "a"); - Expect.equals("a", "" 'a'); - Expect.equals("a", "" r'a'); + Expect.equals( + "a", + "" + "a", + ); + Expect.equals( + "a", + "" + 'a', + ); + Expect.equals( + "a", + "" + r'a', + ); - Expect.equals("b", '' "b"); - Expect.equals("b", '' 'b'); - Expect.equals("b", '' r'b'); + Expect.equals( + "b", + '' + "b", + ); + Expect.equals( + "b", + '' + 'b', + ); + Expect.equals( + "b", + '' + r'b', + ); - Expect.equals("c", r'' "c"); - Expect.equals("c", r'' 'c'); - Expect.equals("c", r'' r'c'); + Expect.equals( + "c", + r'' + "c", + ); + Expect.equals( + "c", + r'' + 'c', + ); + Expect.equals( + "c", + r'' + r'c', + ); } testInterpolation() { var s = "a"; - Expect.equals(r"ab", "$s" "b"); - Expect.equals(r"ab", '$s' "b"); - Expect.equals(r"$sb", r'$s' "b"); + Expect.equals( + r"ab", + "$s" + "b", + ); + Expect.equals( + r"ab", + '$s' + "b", + ); + Expect.equals( + r"$sb", + r'$s' + "b", + ); - Expect.equals(r"-a-b", "-$s-" "b"); - Expect.equals(r"-a-b", '-$s-' "b"); - Expect.equals(r"-$s-b", r'-$s-' "b"); + Expect.equals( + r"-a-b", + "-$s-" + "b", + ); + Expect.equals( + r"-a-b", + '-$s-' + "b", + ); + Expect.equals( + r"-$s-b", + r'-$s-' + "b", + ); - Expect.equals(r"ba", 'b' "$s"); - Expect.equals(r"ba", 'b' '$s'); - Expect.equals(r"b$s", 'b' r'$s'); + Expect.equals( + r"ba", + 'b' + "$s", + ); + Expect.equals( + r"ba", + 'b' + '$s', + ); + Expect.equals( + r"b$s", + 'b' + r'$s', + ); - Expect.equals(r"b-a-", 'b' "-$s-"); - Expect.equals(r"b-a-", 'b' '-$s-'); - Expect.equals(r"b-$s-", 'b' r'-$s-'); + Expect.equals( + r"b-a-", + 'b' + "-$s-", + ); + Expect.equals( + r"b-a-", + 'b' + '-$s-', + ); + Expect.equals( + r"b-$s-", + 'b' + r'-$s-', + ); } testMultiline() { Expect.equals( - "abe", - "a" - "b" - "e"); + "abe", + "a" + "b" + "e", + ); Expect.equals( - "a b e", - "a " - "b " - "e"); + "a b e", + "a " + "b " + "e", + ); Expect.equals( - "a b e", - "a" - " b" - " e"); + "a b e", + "a" + " b" + " e", + ); Expect.equals( - "abe", - """ + "abe", + """ a""" - "b" - "e"); + "b" + "e", + ); Expect.equals( - "a b e", - """ + "a b e", + """ a""" - " b" - " e"); + " b" + " e", + ); Expect.equals( - "abe", - """ + "abe", + """ a""" - """ + """ b""" - """ -e"""); + """ +e""", + ); } diff --git a/tests/language/string/bad_raw_string_runtime_test.dart b/tests/language/string/bad_raw_string_runtime_test.dart index 4046aa54ede..bf010f98e75 100644 --- a/tests/language/string/bad_raw_string_runtime_test.dart +++ b/tests/language/string/bad_raw_string_runtime_test.dart @@ -7,20 +7,14 @@ main() { // Raw String may not contain newline (may not be multi-line). - String x = '' - - - - + String x = + '' // Test that a raw string containing just one character, a \n char, fails. // Enclose the test string in a bigger multiline string, except in case 03: - """ r' ' - """ - - ; + """; } diff --git a/tests/language/string/bad_raw_string_test.dart b/tests/language/string/bad_raw_string_test.dart index 7091ebae6ad..38ac076a6ab 100644 --- a/tests/language/string/bad_raw_string_test.dart +++ b/tests/language/string/bad_raw_string_test.dart @@ -11,7 +11,7 @@ main() { // ^ // [analyzer] SYNTACTIC_ERROR.UNTERMINATED_STRING_LITERAL ' -// [error line 13, column 1, length 1] +// [error column 1, length 1] // [analyzer] SYNTACTIC_ERROR.UNTERMINATED_STRING_LITERAL // [cfe] String starting with ' must end with '. r" @@ -20,7 +20,7 @@ main() { // ^ // [analyzer] SYNTACTIC_ERROR.UNTERMINATED_STRING_LITERAL " -// [error line 22, column 1, length 1] +// [error column 1, length 1] // [analyzer] SYNTACTIC_ERROR.UNTERMINATED_STRING_LITERAL // [cfe] String starting with " must end with ". @@ -35,7 +35,7 @@ main() { // ^ // [analyzer] SYNTACTIC_ERROR.UNTERMINATED_STRING_LITERAL ' -// [error line 37, column 1, length 1] +// [error column 1, length 1] // [analyzer] SYNTACTIC_ERROR.UNTERMINATED_STRING_LITERAL // [cfe] String starting with ' must end with '. ''' diff --git a/tests/language/string/const_interpolation2_test.dart b/tests/language/string/const_interpolation2_test.dart index 78912b703cc..ed6a4681fb7 100644 --- a/tests/language/string/const_interpolation2_test.dart +++ b/tests/language/string/const_interpolation2_test.dart @@ -62,16 +62,18 @@ const interpolation1 = // (Single string, the linebreak to fit this into 80 chars is inside an // interpolation, which is allowed, even for single-line strings). const interpolation2 = - "${u1} ${u2} ${u3} ${u4} ${u5} ${u6} ${n1} ${n2} ${n3} ${n4} ${n5} ${n6} ${ - s1} ${s2} ${s3} ${s4} ${b1} ${b2} ${b3} ${b4}"; + "${u1} ${u2} ${u3} ${u4} ${u5} ${u6} ${n1} ${n2} ${n3} ${n4} ${n5} ${n6} ${s1} ${s2} ${s3} ${s4} ${b1} ${b2} ${b3} ${b4}"; // Adjacent string literals are combined. -const interpolation3 = "$u1 $u2 $u3 $u4 $u5 " +const interpolation3 = + "$u1 $u2 $u3 $u4 $u5 " '$u6 $n1 $n2 $n3 $n4 ' """$n5 $n6 $s1 $s2 $s3 """ '''$s4 $b1 $b2 $b3 $b4'''; // Nested interpolations. -const interpolation4 = "${"$u1 $u2 $u3 $u4 $u5 " '$u6 $n1 $n2 $n3 $n4'} ${ - """$n5 $n6 $s1 $s2 $s3 """ '''$s4 $b1 $b2 $b3 $b4'''}"; +const interpolation4 = + "${"$u1 $u2 $u3 $u4 $u5 " + '$u6 $n1 $n2 $n3 $n4'} ${"""$n5 $n6 $s1 $s2 $s3 """ + '''$s4 $b1 $b2 $b3 $b4'''}"; main() { Expect.equals(u1.toString(), su1); @@ -94,7 +96,8 @@ main() { Expect.equals(b2.toString(), sb2); Expect.equals(b3.toString(), sb3); Expect.equals(b4.toString(), sb4); - var expect = "null null null null null null 42 3.1415 37 4.6692 2.71828 87 " + var expect = + "null null null null null null 42 3.1415 37 4.6692 2.71828 87 " "s1 s2 s1s2 s4 true false false true"; Expect.equals(expect, interpolation1); Expect.equals(expect, interpolation2); diff --git a/tests/language/string/interpolate2_test.dart b/tests/language/string/interpolate2_test.dart index bb49ba519d5..fc70e2a60f7 100644 --- a/tests/language/string/interpolate2_test.dart +++ b/tests/language/string/interpolate2_test.dart @@ -9,7 +9,7 @@ class StringInterpolate2Test { static var F1; static void testMain() { - F1 = "1 + 5 = ${1+5}"; + F1 = "1 + 5 = ${1 + 5}"; Expect.equals("1 + 5 = 6", F1); @@ -23,17 +23,14 @@ class StringInterpolate2Test { Expect.equals("fib(5) = 8", s); i = 5; - s = "$i squared is ${((x) => x*x)(i)}"; + s = "$i squared is ${((x) => x * x)(i)}"; Expect.equals("5 squared is 25", s); Expect.equals("8", "${fib.length}"); // test single quote Expect.equals("8", '${fib.length}'); // test multi-line - Expect.equals( - "8", - '${fib. - length}'); + Expect.equals("8", '${fib.length}'); var map = {"red": 1, "green": 2, "blue": 3}; s = "green has value ${map["green"]}"; @@ -46,8 +43,13 @@ class StringInterpolate2Test { // test multiple levels of nesting, including changing quotes and // multiline string types - s = "a ${(){ return 'b ${(){ return """ -c""";}()}'; }()} d"; + s = + "a ${() { + return 'b ${() { + return """ +c"""; + }()}'; + }()} d"; Expect.equals("a b c d", s); } } diff --git a/tests/language/string/interpolate_test.dart b/tests/language/string/interpolate_test.dart index 5c25f42e18f..95eacdff187 100644 --- a/tests/language/string/interpolate_test.dart +++ b/tests/language/string/interpolate_test.dart @@ -17,9 +17,7 @@ class WhatchamaCallIt { } class ThingamaBob extends WhatchamaCallIt { - ThingamaBob(String s) - : name = s, - super(); + ThingamaBob(String s) : name = s, super(); String name; toString() => "Hansel"; } @@ -78,159 +76,173 @@ void testStringVariants() { // ASCII. Expect.equals(latin * 3, "$latin$latin$latin"); Expect.equals( - latin * 64, - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin"); + latin * 64, + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin", + ); Expect.equals( - latin * 64, - "${latin * 4}${latin * 4}${latin * 4}${latin * 4}" - "${latin * 4}${latin * 4}${latin * 4}${latin * 4}" - "${latin * 4}${latin * 4}${latin * 4}${latin * 4}" - "${latin * 4}${latin * 4}${latin * 4}${latin * 4}"); + latin * 64, + "${latin * 4}${latin * 4}${latin * 4}${latin * 4}" + "${latin * 4}${latin * 4}${latin * 4}${latin * 4}" + "${latin * 4}${latin * 4}${latin * 4}${latin * 4}" + "${latin * 4}${latin * 4}${latin * 4}${latin * 4}", + ); // Non-ASCII. Expect.equals(nonLatin * 3, "$nonLatin$nonLatin$nonLatin"); Expect.equals( - nonLatin * 64, - "$nonLatin$nonLatin$nonLatin$nonLatin" - "$nonLatin$nonLatin$nonLatin$nonLatin" - "$nonLatin$nonLatin$nonLatin$nonLatin" - "$nonLatin$nonLatin$nonLatin$nonLatin" - "$nonLatin$nonLatin$nonLatin$nonLatin" - "$nonLatin$nonLatin$nonLatin$nonLatin" - "$nonLatin$nonLatin$nonLatin$nonLatin" - "$nonLatin$nonLatin$nonLatin$nonLatin" - "$nonLatin$nonLatin$nonLatin$nonLatin" - "$nonLatin$nonLatin$nonLatin$nonLatin" - "$nonLatin$nonLatin$nonLatin$nonLatin" - "$nonLatin$nonLatin$nonLatin$nonLatin" - "$nonLatin$nonLatin$nonLatin$nonLatin" - "$nonLatin$nonLatin$nonLatin$nonLatin" - "$nonLatin$nonLatin$nonLatin$nonLatin" - "$nonLatin$nonLatin$nonLatin$nonLatin"); + nonLatin * 64, + "$nonLatin$nonLatin$nonLatin$nonLatin" + "$nonLatin$nonLatin$nonLatin$nonLatin" + "$nonLatin$nonLatin$nonLatin$nonLatin" + "$nonLatin$nonLatin$nonLatin$nonLatin" + "$nonLatin$nonLatin$nonLatin$nonLatin" + "$nonLatin$nonLatin$nonLatin$nonLatin" + "$nonLatin$nonLatin$nonLatin$nonLatin" + "$nonLatin$nonLatin$nonLatin$nonLatin" + "$nonLatin$nonLatin$nonLatin$nonLatin" + "$nonLatin$nonLatin$nonLatin$nonLatin" + "$nonLatin$nonLatin$nonLatin$nonLatin" + "$nonLatin$nonLatin$nonLatin$nonLatin" + "$nonLatin$nonLatin$nonLatin$nonLatin" + "$nonLatin$nonLatin$nonLatin$nonLatin" + "$nonLatin$nonLatin$nonLatin$nonLatin" + "$nonLatin$nonLatin$nonLatin$nonLatin", + ); Expect.equals( - nonLatin * 64, - "${nonLatin * 4}${nonLatin * 4}" - "${nonLatin * 4}${nonLatin * 4}" - "${nonLatin * 4}${nonLatin * 4}" - "${nonLatin * 4}${nonLatin * 4}" - "${nonLatin * 4}${nonLatin * 4}" - "${nonLatin * 4}${nonLatin * 4}" - "${nonLatin * 4}${nonLatin * 4}" - "${nonLatin * 4}${nonLatin * 4}"); + nonLatin * 64, + "${nonLatin * 4}${nonLatin * 4}" + "${nonLatin * 4}${nonLatin * 4}" + "${nonLatin * 4}${nonLatin * 4}" + "${nonLatin * 4}${nonLatin * 4}" + "${nonLatin * 4}${nonLatin * 4}" + "${nonLatin * 4}${nonLatin * 4}" + "${nonLatin * 4}${nonLatin * 4}" + "${nonLatin * 4}${nonLatin * 4}", + ); // Mixed. Expect.equals(latin * 3 + nonLatin, "$latin$latin$latin$nonLatin"); Expect.equals(nonLatin + latin * 3, "$nonLatin$latin$latin$latin"); Expect.equals( - latin * 60 + nonLatin * 4, - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin" - "$nonLatin$nonLatin$nonLatin$nonLatin"); + latin * 60 + nonLatin * 4, + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin" + "$nonLatin$nonLatin$nonLatin$nonLatin", + ); Expect.equals( - nonLatin * 4 + latin * 60, - "$nonLatin$nonLatin$nonLatin$nonLatin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin$latin$latin$latin$latin" - "$latin$latin$latin$latin"); + nonLatin * 4 + latin * 60, + "$nonLatin$nonLatin$nonLatin$nonLatin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin$latin$latin$latin$latin" + "$latin$latin$latin$latin", + ); Expect.equals( - latin * 60 + nonLatin * 4, - "${latin * 4}${latin * 4}${latin * 4}${latin * 4}" - "${latin * 4}${latin * 4}${latin * 4}${latin * 4}" - "${latin * 4}${latin * 4}${latin * 4}${latin * 4}" - "${latin * 4}${latin * 4}${latin * 4}${nonLatin * 4}"); + latin * 60 + nonLatin * 4, + "${latin * 4}${latin * 4}${latin * 4}${latin * 4}" + "${latin * 4}${latin * 4}${latin * 4}${latin * 4}" + "${latin * 4}${latin * 4}${latin * 4}${latin * 4}" + "${latin * 4}${latin * 4}${latin * 4}${nonLatin * 4}", + ); Expect.equals( - nonLatin * 4 + latin * 60, - "${nonLatin * 4}${latin * 4}${latin * 4}${latin * 4}" - "${latin * 4}${latin * 4}${latin * 4}${latin * 4}" - "${latin * 4}${latin * 4}${latin * 4}${latin * 4}" - "${latin * 4}${latin * 4}${latin * 4}${latin * 4}"); + nonLatin * 4 + latin * 60, + "${nonLatin * 4}${latin * 4}${latin * 4}${latin * 4}" + "${latin * 4}${latin * 4}${latin * 4}${latin * 4}" + "${latin * 4}${latin * 4}${latin * 4}${latin * 4}" + "${latin * 4}${latin * 4}${latin * 4}${latin * 4}", + ); // With objects. Expect.equals(latin * 3, "$latin$oLatin$latin"); Expect.equals( - latin * 64, - "$latin$latin$latin$latin$latin$latin$latin$oLatin" - "$latin$latin$latin$latin$latin$latin$latin$oLatin" - "$latin$latin$latin$latin$latin$latin$latin$oLatin" - "$latin$latin$latin$latin$latin$latin$latin$oLatin" - "$latin$latin$latin$latin$latin$latin$latin$oLatin" - "$latin$latin$latin$latin$latin$latin$latin$oLatin" - "$latin$latin$latin$latin$latin$latin$latin$oLatin" - "$latin$latin$latin$latin$latin$latin$latin$oLatin"); + latin * 64, + "$latin$latin$latin$latin$latin$latin$latin$oLatin" + "$latin$latin$latin$latin$latin$latin$latin$oLatin" + "$latin$latin$latin$latin$latin$latin$latin$oLatin" + "$latin$latin$latin$latin$latin$latin$latin$oLatin" + "$latin$latin$latin$latin$latin$latin$latin$oLatin" + "$latin$latin$latin$latin$latin$latin$latin$oLatin" + "$latin$latin$latin$latin$latin$latin$latin$oLatin" + "$latin$latin$latin$latin$latin$latin$latin$oLatin", + ); Expect.equals( - latin * 64, - "${latin * 4}${latin * 4}${latin * 4}${oLatin * 4}" - "${latin * 4}${latin * 4}${latin * 4}${oLatin * 4}" - "${latin * 4}${latin * 4}${latin * 4}${oLatin * 4}" - "${latin * 4}${latin * 4}${latin * 4}${oLatin * 4}"); + latin * 64, + "${latin * 4}${latin * 4}${latin * 4}${oLatin * 4}" + "${latin * 4}${latin * 4}${latin * 4}${oLatin * 4}" + "${latin * 4}${latin * 4}${latin * 4}${oLatin * 4}" + "${latin * 4}${latin * 4}${latin * 4}${oLatin * 4}", + ); // Non-ASCII. Expect.equals(nonLatin * 3, "$nonLatin$oNonLatin$nonLatin"); Expect.equals( - nonLatin * 64, - "$nonLatin$nonLatin$nonLatin$oNonLatin" - "$nonLatin$nonLatin$nonLatin$oNonLatin" - "$nonLatin$nonLatin$nonLatin$oNonLatin" - "$nonLatin$nonLatin$nonLatin$oNonLatin" - "$nonLatin$nonLatin$nonLatin$oNonLatin" - "$nonLatin$nonLatin$nonLatin$oNonLatin" - "$nonLatin$nonLatin$nonLatin$oNonLatin" - "$nonLatin$nonLatin$nonLatin$oNonLatin" - "$nonLatin$nonLatin$nonLatin$oNonLatin" - "$nonLatin$nonLatin$nonLatin$oNonLatin" - "$nonLatin$nonLatin$nonLatin$oNonLatin" - "$nonLatin$nonLatin$nonLatin$oNonLatin" - "$nonLatin$nonLatin$nonLatin$oNonLatin" - "$nonLatin$nonLatin$nonLatin$oNonLatin" - "$nonLatin$nonLatin$nonLatin$oNonLatin" - "$nonLatin$nonLatin$nonLatin$oNonLatin"); + nonLatin * 64, + "$nonLatin$nonLatin$nonLatin$oNonLatin" + "$nonLatin$nonLatin$nonLatin$oNonLatin" + "$nonLatin$nonLatin$nonLatin$oNonLatin" + "$nonLatin$nonLatin$nonLatin$oNonLatin" + "$nonLatin$nonLatin$nonLatin$oNonLatin" + "$nonLatin$nonLatin$nonLatin$oNonLatin" + "$nonLatin$nonLatin$nonLatin$oNonLatin" + "$nonLatin$nonLatin$nonLatin$oNonLatin" + "$nonLatin$nonLatin$nonLatin$oNonLatin" + "$nonLatin$nonLatin$nonLatin$oNonLatin" + "$nonLatin$nonLatin$nonLatin$oNonLatin" + "$nonLatin$nonLatin$nonLatin$oNonLatin" + "$nonLatin$nonLatin$nonLatin$oNonLatin" + "$nonLatin$nonLatin$nonLatin$oNonLatin" + "$nonLatin$nonLatin$nonLatin$oNonLatin" + "$nonLatin$nonLatin$nonLatin$oNonLatin", + ); Expect.equals( - nonLatin * 64, - "${nonLatin * 4}${oNonLatin * 4}" - "${nonLatin * 4}${oNonLatin * 4}" - "${nonLatin * 4}${oNonLatin * 4}" - "${nonLatin * 4}${oNonLatin * 4}" - "${nonLatin * 4}${oNonLatin * 4}" - "${nonLatin * 4}${oNonLatin * 4}" - "${nonLatin * 4}${oNonLatin * 4}" - "${nonLatin * 4}${oNonLatin * 4}"); + nonLatin * 64, + "${nonLatin * 4}${oNonLatin * 4}" + "${nonLatin * 4}${oNonLatin * 4}" + "${nonLatin * 4}${oNonLatin * 4}" + "${nonLatin * 4}${oNonLatin * 4}" + "${nonLatin * 4}${oNonLatin * 4}" + "${nonLatin * 4}${oNonLatin * 4}" + "${nonLatin * 4}${oNonLatin * 4}" + "${nonLatin * 4}${oNonLatin * 4}", + ); // Mixed. Expect.equals(latin * 2 + nonLatin * 2, "$latin$oLatin$nonLatin$oNonLatin"); Expect.equals(nonLatin * 2 + latin * 2, "$nonLatin$oNonLatin$latin$oLatin"); Expect.equals( - (latin * 2 + nonLatin * 2) * 8, - "$latin$oLatin$nonLatin$oNonLatin" - "$latin$oLatin$nonLatin$oNonLatin" - "$latin$oLatin$nonLatin$oNonLatin" - "$latin$oLatin$nonLatin$oNonLatin" - "$latin$oLatin$nonLatin$oNonLatin" - "$latin$oLatin$nonLatin$oNonLatin" - "$latin$oLatin$nonLatin$oNonLatin" - "$latin$oLatin$nonLatin$oNonLatin"); + (latin * 2 + nonLatin * 2) * 8, + "$latin$oLatin$nonLatin$oNonLatin" + "$latin$oLatin$nonLatin$oNonLatin" + "$latin$oLatin$nonLatin$oNonLatin" + "$latin$oLatin$nonLatin$oNonLatin" + "$latin$oLatin$nonLatin$oNonLatin" + "$latin$oLatin$nonLatin$oNonLatin" + "$latin$oLatin$nonLatin$oNonLatin" + "$latin$oLatin$nonLatin$oNonLatin", + ); Expect.equals( - (nonLatin * 2 + latin * 2) * 8, - "$nonLatin$oNonLatin$latin$oLatin" - "$nonLatin$oNonLatin$latin$oLatin" - "$nonLatin$oNonLatin$latin$oLatin" - "$nonLatin$oNonLatin$latin$oLatin" - "$nonLatin$oNonLatin$latin$oLatin" - "$nonLatin$oNonLatin$latin$oLatin" - "$nonLatin$oNonLatin$latin$oLatin" - "$nonLatin$oNonLatin$latin$oLatin"); + (nonLatin * 2 + latin * 2) * 8, + "$nonLatin$oNonLatin$latin$oLatin" + "$nonLatin$oNonLatin$latin$oLatin" + "$nonLatin$oNonLatin$latin$oLatin" + "$nonLatin$oNonLatin$latin$oLatin" + "$nonLatin$oNonLatin$latin$oLatin" + "$nonLatin$oNonLatin$latin$oLatin" + "$nonLatin$oNonLatin$latin$oLatin" + "$nonLatin$oNonLatin$latin$oLatin", + ); // All combinations var o1 = new Stringable("x"); diff --git a/tests/language/string/interpolation1_runtime_test.dart b/tests/language/string/interpolation1_runtime_test.dart index 3ede1d84192..ad3ce231e39 100644 --- a/tests/language/string/interpolation1_runtime_test.dart +++ b/tests/language/string/interpolation1_runtime_test.dart @@ -15,9 +15,7 @@ class A { class StringInterpolation1NegativeTest { // Dollar not followed by "{" or identifier. - static testMain() { - - } + static testMain() {} } main() { diff --git a/tests/language/string/interpolation2_runtime_test.dart b/tests/language/string/interpolation2_runtime_test.dart index 0b0a89f37d2..01d0c64af06 100644 --- a/tests/language/string/interpolation2_runtime_test.dart +++ b/tests/language/string/interpolation2_runtime_test.dart @@ -10,7 +10,6 @@ class StringInterpolation2NegativeTest { static testMain() { // Dollar followed by "/". - } } diff --git a/tests/language/string/interpolation3_runtime_test.dart b/tests/language/string/interpolation3_runtime_test.dart index 96b92fbdc80..871f77145c7 100644 --- a/tests/language/string/interpolation3_runtime_test.dart +++ b/tests/language/string/interpolation3_runtime_test.dart @@ -10,7 +10,6 @@ class StringInterpolation3NegativeTest { static testMain() { // Dollar followed by a number. - } } diff --git a/tests/language/string/interpolation4_runtime_test.dart b/tests/language/string/interpolation4_runtime_test.dart index e89625c0aaf..98cd42510e6 100644 --- a/tests/language/string/interpolation4_runtime_test.dart +++ b/tests/language/string/interpolation4_runtime_test.dart @@ -10,7 +10,6 @@ class StringInterpolation4NegativeTest { static testMain() { // Dollar not followed by "{" or identifier. - } } diff --git a/tests/language/string/interpolation5_runtime_test.dart b/tests/language/string/interpolation5_runtime_test.dart index acbec21dc6c..faee25071bb 100644 --- a/tests/language/string/interpolation5_runtime_test.dart +++ b/tests/language/string/interpolation5_runtime_test.dart @@ -10,7 +10,6 @@ class StringInterpolation5NegativeTest { static testMain() { // Dollar followed by a number. - } } diff --git a/tests/language/string/interpolation9_runtime_test.dart b/tests/language/string/interpolation9_runtime_test.dart index 3cf2bd10bfe..1391790aa5f 100644 --- a/tests/language/string/interpolation9_runtime_test.dart +++ b/tests/language/string/interpolation9_runtime_test.dart @@ -10,29 +10,5 @@ main() { var x; - - - - - - - - - - - - - - - - - - - - - - - - return x; } diff --git a/tests/language/string/interpolation_and_buffer_test.dart b/tests/language/string/interpolation_and_buffer_test.dart index 7086276ce58..c9afd2e7336 100644 --- a/tests/language/string/interpolation_and_buffer_test.dart +++ b/tests/language/string/interpolation_and_buffer_test.dart @@ -47,13 +47,23 @@ void main() { // Throws immediately when adding object that doesn't return a String. Expect.equals( - (StringBuffer()..write(s)..write(s)).toString(), "StringString"); + (StringBuffer() + ..write(s) + ..write(s)) + .toString(), + "StringString", + ); Expect.throws( - () => StringBuffer()..write(t)..write(throw "unreachable"), - (e) => e == "Throw"); + () => StringBuffer() + ..write(t) + ..write(throw "unreachable"), + (e) => e == "Throw", + ); // Same behavior for constructor argument as if adding it to buffer later. Expect.equals((StringBuffer(s)..write(s)).toString(), "StringString"); Expect.throws( - () => StringBuffer(t)..write(throw "unreachable"), (e) => e == "Throw"); + () => StringBuffer(t)..write(throw "unreachable"), + (e) => e == "Throw", + ); } diff --git a/tests/language/string/interpolation_newline_test.dart b/tests/language/string/interpolation_newline_test.dart index 91ad04f5242..e13e276ef01 100644 --- a/tests/language/string/interpolation_newline_test.dart +++ b/tests/language/string/interpolation_newline_test.dart @@ -6,13 +6,24 @@ main() { String expected = '[[{{}: {}}]]'; - String a = "${ [ "${ [ '${ { '${ { } }' : { } } }' ] }" ] }"; - String b = "${ [ "${ [ '${ { '${ - { } }' : { } } }' ] }" ] }"; - String c = "${ [ "${ [ '${ { '${ - { - } }' : { - } } }' ] }" ] }"; + String a = + "${[ + "${[ + '${{'${{}}': {}}}', + ]}", + ]}"; + String b = + "${[ + "${[ + '${{'${{}}': {}}}', + ]}", + ]}"; + String c = + "${[ + "${[ + '${{'${{}}': {}}}', + ]}", + ]}"; if (expected != a) throw 'expecteda: $expected != $a'; if (a != b) throw 'ab: $a != $b'; if (b != c) throw 'bc: $b != $c'; diff --git a/tests/language/string/interpolation_runtime_test.dart b/tests/language/string/interpolation_runtime_test.dart index 90623b8e31e..e8753ef7da3 100644 --- a/tests/language/string/interpolation_runtime_test.dart +++ b/tests/language/string/interpolation_runtime_test.dart @@ -60,9 +60,7 @@ class StringInterpolationTest { Expect.equals("2", "escaped \${3+2}"[16]); Expect.equals("}", "escaped \${3+2}"[17]); - if (alwaysFalse) { - - } + if (alwaysFalse) {} Expect.equals("${m}", "$m"); } diff --git a/tests/language/string/literals_test.dart b/tests/language/string/literals_test.dart index 6b4f4f50706..b3c13aed0bc 100644 --- a/tests/language/string/literals_test.dart +++ b/tests/language/string/literals_test.dart @@ -5,8 +5,18 @@ import "package:expect/expect.dart"; main() { - var expect = new String.fromCharCodes( - [0, 0x0a, 0x0d, 0x7f, 0xff, 0xffff, 0xd800, 0xdc00, 0xdbff, 0xdfff]); + var expect = new String.fromCharCodes([ + 0, + 0x0a, + 0x0d, + 0x7f, + 0xff, + 0xffff, + 0xd800, + 0xdc00, + 0xdbff, + 0xdfff, + ]); test(string) { Expect.equals(expect, string); } @@ -27,12 +37,12 @@ main() { test('''\x00 \x0d\x7f\xff\uffff\ud800\udc00\udbff\udfff'''); // Extract code points from multi-character escape string. - test("\x00\x0a\x0d\x7f\xff\uffff" - "${"\u{10000}"[0]}${"\u{10000}"[1]}" - "${"\u{10FFFF}"[0]}${"\u{10FFFF}"[1]}"); + test( + "\x00\x0a\x0d\x7f\xff\uffff" + "${"\u{10000}"[0]}${"\u{10000}"[1]}" + "${"\u{10FFFF}"[0]}${"\u{10FFFF}"[1]}", + ); test("\x00\x0a\x0d\x7f\xff\uffff" + "\ud800" + "\udc00\udbff" + "\udfff"); // Single line string over multiple lines with newlines inside interpolation. - test("\x00\x0a\x0d\x7f\xff${ - "" - }\uffff\ud800\udc00\udbff\udfff"); + test("\x00\x0a\x0d\x7f\xff${""}\uffff\ud800\udc00\udbff\udfff"); } diff --git a/tests/language/string/multiline_newline_crlf.dart b/tests/language/string/multiline_newline_crlf.dart index 958a82c8499..bde9ea23e1c 100644 --- a/tests/language/string/multiline_newline_crlf.dart +++ b/tests/language/string/multiline_newline_crlf.dart @@ -25,4 +25,4 @@ const constantRawMultilineString = r""" var nonConstantRawMultilineString = r""" \a \b -"""; \ No newline at end of file +"""; diff --git a/tests/language/string/multiline_newline_runtime_1_test.dart b/tests/language/string/multiline_newline_runtime_1_test.dart index 0b4647a3129..f6999cc2d15 100644 --- a/tests/language/string/multiline_newline_runtime_1_test.dart +++ b/tests/language/string/multiline_newline_runtime_1_test.dart @@ -40,18 +40,27 @@ main() { Expect.equals(lf.nonConstantMultilineString, cr.nonConstantMultilineString); Expect.equals( - cr.nonConstantRawMultilineString, crlf.nonConstantRawMultilineString); + cr.nonConstantRawMultilineString, + crlf.nonConstantRawMultilineString, + ); Expect.equals( - crlf.nonConstantRawMultilineString, lf.nonConstantRawMultilineString); + crlf.nonConstantRawMultilineString, + lf.nonConstantRawMultilineString, + ); Expect.equals( - lf.nonConstantRawMultilineString, cr.nonConstantRawMultilineString); + lf.nonConstantRawMultilineString, + cr.nonConstantRawMultilineString, + ); - const c1 = - cr.constantMultilineString == crlf.constantMultilineString ? true : null; - const c2 = - crlf.constantMultilineString == lf.constantMultilineString ? true : null; - const c3 = - lf.constantMultilineString == cr.constantMultilineString ? true : null; + const c1 = cr.constantMultilineString == crlf.constantMultilineString + ? true + : null; + const c2 = crlf.constantMultilineString == lf.constantMultilineString + ? true + : null; + const c3 = lf.constantMultilineString == cr.constantMultilineString + ? true + : null; Expect.isTrue(c1); Expect.isTrue(c2); Expect.isTrue(c3); @@ -72,27 +81,15 @@ main() { const c4 = c1 == true ? 1 : 2; Expect.equals(1, c4); - - - - - - - - - - - - - - - - const c7 = - cr.constantMultilineString != crlf.constantMultilineString ? true : null; - const c8 = - crlf.constantMultilineString != lf.constantMultilineString ? true : null; - const c9 = - lf.constantMultilineString != cr.constantMultilineString ? true : null; + const c7 = cr.constantMultilineString != crlf.constantMultilineString + ? true + : null; + const c8 = crlf.constantMultilineString != lf.constantMultilineString + ? true + : null; + const c9 = lf.constantMultilineString != cr.constantMultilineString + ? true + : null; Expect.isNull(c7); Expect.isNull(c8); Expect.isNull(c9); @@ -118,11 +115,4 @@ main() { // constants is similar to the runtime evaluation tested above. For tools // like the analyzer, this ensures that evaluation is tested (there's no // runtime evaluation). - - - - - - - } diff --git a/tests/language/string/multiline_newline_runtime_2_test.dart b/tests/language/string/multiline_newline_runtime_2_test.dart index 984ee097ccf..5f83bed2240 100644 --- a/tests/language/string/multiline_newline_runtime_2_test.dart +++ b/tests/language/string/multiline_newline_runtime_2_test.dart @@ -40,18 +40,27 @@ main() { Expect.equals(lf.nonConstantMultilineString, cr.nonConstantMultilineString); Expect.equals( - cr.nonConstantRawMultilineString, crlf.nonConstantRawMultilineString); + cr.nonConstantRawMultilineString, + crlf.nonConstantRawMultilineString, + ); Expect.equals( - crlf.nonConstantRawMultilineString, lf.nonConstantRawMultilineString); + crlf.nonConstantRawMultilineString, + lf.nonConstantRawMultilineString, + ); Expect.equals( - lf.nonConstantRawMultilineString, cr.nonConstantRawMultilineString); + lf.nonConstantRawMultilineString, + cr.nonConstantRawMultilineString, + ); - const c1 = - cr.constantMultilineString == crlf.constantMultilineString ? true : null; - const c2 = - crlf.constantMultilineString == lf.constantMultilineString ? true : null; - const c3 = - lf.constantMultilineString == cr.constantMultilineString ? true : null; + const c1 = cr.constantMultilineString == crlf.constantMultilineString + ? true + : null; + const c2 = crlf.constantMultilineString == lf.constantMultilineString + ? true + : null; + const c3 = lf.constantMultilineString == cr.constantMultilineString + ? true + : null; Expect.isTrue(c1); Expect.isTrue(c2); Expect.isTrue(c3); @@ -69,30 +78,18 @@ main() { Expect.isTrue(c2r); Expect.isTrue(c3r); - - - const c5 = c2 == true ? 2 : 3; Expect.equals(2, c5); - - - - - - - - - - - - - const c7 = - cr.constantMultilineString != crlf.constantMultilineString ? true : null; - const c8 = - crlf.constantMultilineString != lf.constantMultilineString ? true : null; - const c9 = - lf.constantMultilineString != cr.constantMultilineString ? true : null; + const c7 = cr.constantMultilineString != crlf.constantMultilineString + ? true + : null; + const c8 = crlf.constantMultilineString != lf.constantMultilineString + ? true + : null; + const c9 = lf.constantMultilineString != cr.constantMultilineString + ? true + : null; Expect.isNull(c7); Expect.isNull(c8); Expect.isNull(c9); @@ -118,11 +115,4 @@ main() { // constants is similar to the runtime evaluation tested above. For tools // like the analyzer, this ensures that evaluation is tested (there's no // runtime evaluation). - - - - - - - } diff --git a/tests/language/string/multiline_newline_runtime_3_test.dart b/tests/language/string/multiline_newline_runtime_3_test.dart index 8208eeae74b..6608232a4ce 100644 --- a/tests/language/string/multiline_newline_runtime_3_test.dart +++ b/tests/language/string/multiline_newline_runtime_3_test.dart @@ -40,18 +40,27 @@ main() { Expect.equals(lf.nonConstantMultilineString, cr.nonConstantMultilineString); Expect.equals( - cr.nonConstantRawMultilineString, crlf.nonConstantRawMultilineString); + cr.nonConstantRawMultilineString, + crlf.nonConstantRawMultilineString, + ); Expect.equals( - crlf.nonConstantRawMultilineString, lf.nonConstantRawMultilineString); + crlf.nonConstantRawMultilineString, + lf.nonConstantRawMultilineString, + ); Expect.equals( - lf.nonConstantRawMultilineString, cr.nonConstantRawMultilineString); + lf.nonConstantRawMultilineString, + cr.nonConstantRawMultilineString, + ); - const c1 = - cr.constantMultilineString == crlf.constantMultilineString ? true : null; - const c2 = - crlf.constantMultilineString == lf.constantMultilineString ? true : null; - const c3 = - lf.constantMultilineString == cr.constantMultilineString ? true : null; + const c1 = cr.constantMultilineString == crlf.constantMultilineString + ? true + : null; + const c2 = crlf.constantMultilineString == lf.constantMultilineString + ? true + : null; + const c3 = lf.constantMultilineString == cr.constantMultilineString + ? true + : null; Expect.isTrue(c1); Expect.isTrue(c2); Expect.isTrue(c3); @@ -69,30 +78,18 @@ main() { Expect.isTrue(c2r); Expect.isTrue(c3r); - - - - - - const c6 = c3 == true ? 3 : 4; Expect.equals(3, c6); - - - - - - - - - - const c7 = - cr.constantMultilineString != crlf.constantMultilineString ? true : null; - const c8 = - crlf.constantMultilineString != lf.constantMultilineString ? true : null; - const c9 = - lf.constantMultilineString != cr.constantMultilineString ? true : null; + const c7 = cr.constantMultilineString != crlf.constantMultilineString + ? true + : null; + const c8 = crlf.constantMultilineString != lf.constantMultilineString + ? true + : null; + const c9 = lf.constantMultilineString != cr.constantMultilineString + ? true + : null; Expect.isNull(c7); Expect.isNull(c8); Expect.isNull(c9); @@ -118,11 +115,4 @@ main() { // constants is similar to the runtime evaluation tested above. For tools // like the analyzer, this ensures that evaluation is tested (there's no // runtime evaluation). - - - - - - - } diff --git a/tests/language/string/multiline_newline_runtime_4_test.dart b/tests/language/string/multiline_newline_runtime_4_test.dart index caef817dd07..2d5efb08a4a 100644 --- a/tests/language/string/multiline_newline_runtime_4_test.dart +++ b/tests/language/string/multiline_newline_runtime_4_test.dart @@ -40,18 +40,27 @@ main() { Expect.equals(lf.nonConstantMultilineString, cr.nonConstantMultilineString); Expect.equals( - cr.nonConstantRawMultilineString, crlf.nonConstantRawMultilineString); + cr.nonConstantRawMultilineString, + crlf.nonConstantRawMultilineString, + ); Expect.equals( - crlf.nonConstantRawMultilineString, lf.nonConstantRawMultilineString); + crlf.nonConstantRawMultilineString, + lf.nonConstantRawMultilineString, + ); Expect.equals( - lf.nonConstantRawMultilineString, cr.nonConstantRawMultilineString); + lf.nonConstantRawMultilineString, + cr.nonConstantRawMultilineString, + ); - const c1 = - cr.constantMultilineString == crlf.constantMultilineString ? true : null; - const c2 = - crlf.constantMultilineString == lf.constantMultilineString ? true : null; - const c3 = - lf.constantMultilineString == cr.constantMultilineString ? true : null; + const c1 = cr.constantMultilineString == crlf.constantMultilineString + ? true + : null; + const c2 = crlf.constantMultilineString == lf.constantMultilineString + ? true + : null; + const c3 = lf.constantMultilineString == cr.constantMultilineString + ? true + : null; Expect.isTrue(c1); Expect.isTrue(c2); Expect.isTrue(c3); @@ -69,30 +78,18 @@ main() { Expect.isTrue(c2r); Expect.isTrue(c3r); - - - - - - - - - const c4r = c1r == true ? 1 : 2; Expect.equals(1, c4r); - - - - - - - const c7 = - cr.constantMultilineString != crlf.constantMultilineString ? true : null; - const c8 = - crlf.constantMultilineString != lf.constantMultilineString ? true : null; - const c9 = - lf.constantMultilineString != cr.constantMultilineString ? true : null; + const c7 = cr.constantMultilineString != crlf.constantMultilineString + ? true + : null; + const c8 = crlf.constantMultilineString != lf.constantMultilineString + ? true + : null; + const c9 = lf.constantMultilineString != cr.constantMultilineString + ? true + : null; Expect.isNull(c7); Expect.isNull(c8); Expect.isNull(c9); @@ -118,11 +115,4 @@ main() { // constants is similar to the runtime evaluation tested above. For tools // like the analyzer, this ensures that evaluation is tested (there's no // runtime evaluation). - - - - - - - } diff --git a/tests/language/string/multiline_newline_runtime_5_test.dart b/tests/language/string/multiline_newline_runtime_5_test.dart index 6510e9cc205..830f7a8bd8d 100644 --- a/tests/language/string/multiline_newline_runtime_5_test.dart +++ b/tests/language/string/multiline_newline_runtime_5_test.dart @@ -40,18 +40,27 @@ main() { Expect.equals(lf.nonConstantMultilineString, cr.nonConstantMultilineString); Expect.equals( - cr.nonConstantRawMultilineString, crlf.nonConstantRawMultilineString); + cr.nonConstantRawMultilineString, + crlf.nonConstantRawMultilineString, + ); Expect.equals( - crlf.nonConstantRawMultilineString, lf.nonConstantRawMultilineString); + crlf.nonConstantRawMultilineString, + lf.nonConstantRawMultilineString, + ); Expect.equals( - lf.nonConstantRawMultilineString, cr.nonConstantRawMultilineString); + lf.nonConstantRawMultilineString, + cr.nonConstantRawMultilineString, + ); - const c1 = - cr.constantMultilineString == crlf.constantMultilineString ? true : null; - const c2 = - crlf.constantMultilineString == lf.constantMultilineString ? true : null; - const c3 = - lf.constantMultilineString == cr.constantMultilineString ? true : null; + const c1 = cr.constantMultilineString == crlf.constantMultilineString + ? true + : null; + const c2 = crlf.constantMultilineString == lf.constantMultilineString + ? true + : null; + const c3 = lf.constantMultilineString == cr.constantMultilineString + ? true + : null; Expect.isTrue(c1); Expect.isTrue(c2); Expect.isTrue(c3); @@ -69,30 +78,18 @@ main() { Expect.isTrue(c2r); Expect.isTrue(c3r); - - - - - - - - - - - - const c5r = c2r == true ? 2 : 3; Expect.equals(2, c5r); - - - - const c7 = - cr.constantMultilineString != crlf.constantMultilineString ? true : null; - const c8 = - crlf.constantMultilineString != lf.constantMultilineString ? true : null; - const c9 = - lf.constantMultilineString != cr.constantMultilineString ? true : null; + const c7 = cr.constantMultilineString != crlf.constantMultilineString + ? true + : null; + const c8 = crlf.constantMultilineString != lf.constantMultilineString + ? true + : null; + const c9 = lf.constantMultilineString != cr.constantMultilineString + ? true + : null; Expect.isNull(c7); Expect.isNull(c8); Expect.isNull(c9); @@ -118,11 +115,4 @@ main() { // constants is similar to the runtime evaluation tested above. For tools // like the analyzer, this ensures that evaluation is tested (there's no // runtime evaluation). - - - - - - - } diff --git a/tests/language/string/multiline_newline_runtime_6_test.dart b/tests/language/string/multiline_newline_runtime_6_test.dart index 353fb285d07..5d4fa1ed189 100644 --- a/tests/language/string/multiline_newline_runtime_6_test.dart +++ b/tests/language/string/multiline_newline_runtime_6_test.dart @@ -40,18 +40,27 @@ main() { Expect.equals(lf.nonConstantMultilineString, cr.nonConstantMultilineString); Expect.equals( - cr.nonConstantRawMultilineString, crlf.nonConstantRawMultilineString); + cr.nonConstantRawMultilineString, + crlf.nonConstantRawMultilineString, + ); Expect.equals( - crlf.nonConstantRawMultilineString, lf.nonConstantRawMultilineString); + crlf.nonConstantRawMultilineString, + lf.nonConstantRawMultilineString, + ); Expect.equals( - lf.nonConstantRawMultilineString, cr.nonConstantRawMultilineString); + lf.nonConstantRawMultilineString, + cr.nonConstantRawMultilineString, + ); - const c1 = - cr.constantMultilineString == crlf.constantMultilineString ? true : null; - const c2 = - crlf.constantMultilineString == lf.constantMultilineString ? true : null; - const c3 = - lf.constantMultilineString == cr.constantMultilineString ? true : null; + const c1 = cr.constantMultilineString == crlf.constantMultilineString + ? true + : null; + const c2 = crlf.constantMultilineString == lf.constantMultilineString + ? true + : null; + const c3 = lf.constantMultilineString == cr.constantMultilineString + ? true + : null; Expect.isTrue(c1); Expect.isTrue(c2); Expect.isTrue(c3); @@ -69,30 +78,18 @@ main() { Expect.isTrue(c2r); Expect.isTrue(c3r); - - - - - - - - - - - - - - - const c6r = c3r == true ? 3 : 4; Expect.equals(3, c6r); - const c7 = - cr.constantMultilineString != crlf.constantMultilineString ? true : null; - const c8 = - crlf.constantMultilineString != lf.constantMultilineString ? true : null; - const c9 = - lf.constantMultilineString != cr.constantMultilineString ? true : null; + const c7 = cr.constantMultilineString != crlf.constantMultilineString + ? true + : null; + const c8 = crlf.constantMultilineString != lf.constantMultilineString + ? true + : null; + const c9 = lf.constantMultilineString != cr.constantMultilineString + ? true + : null; Expect.isNull(c7); Expect.isNull(c8); Expect.isNull(c9); @@ -118,11 +115,4 @@ main() { // constants is similar to the runtime evaluation tested above. For tools // like the analyzer, this ensures that evaluation is tested (there's no // runtime evaluation). - - - - - - - } diff --git a/tests/language/string/multiline_newline_runtime_test.dart b/tests/language/string/multiline_newline_runtime_test.dart index 7fa95cad940..1c9c80f38e7 100644 --- a/tests/language/string/multiline_newline_runtime_test.dart +++ b/tests/language/string/multiline_newline_runtime_test.dart @@ -40,18 +40,27 @@ main() { Expect.equals(lf.nonConstantMultilineString, cr.nonConstantMultilineString); Expect.equals( - cr.nonConstantRawMultilineString, crlf.nonConstantRawMultilineString); + cr.nonConstantRawMultilineString, + crlf.nonConstantRawMultilineString, + ); Expect.equals( - crlf.nonConstantRawMultilineString, lf.nonConstantRawMultilineString); + crlf.nonConstantRawMultilineString, + lf.nonConstantRawMultilineString, + ); Expect.equals( - lf.nonConstantRawMultilineString, cr.nonConstantRawMultilineString); + lf.nonConstantRawMultilineString, + cr.nonConstantRawMultilineString, + ); - const c1 = - cr.constantMultilineString == crlf.constantMultilineString ? true : null; - const c2 = - crlf.constantMultilineString == lf.constantMultilineString ? true : null; - const c3 = - lf.constantMultilineString == cr.constantMultilineString ? true : null; + const c1 = cr.constantMultilineString == crlf.constantMultilineString + ? true + : null; + const c2 = crlf.constantMultilineString == lf.constantMultilineString + ? true + : null; + const c3 = lf.constantMultilineString == cr.constantMultilineString + ? true + : null; Expect.isTrue(c1); Expect.isTrue(c2); Expect.isTrue(c3); @@ -69,30 +78,15 @@ main() { Expect.isTrue(c2r); Expect.isTrue(c3r); - - - - - - - - - - - - - - - - - - - const c7 = - cr.constantMultilineString != crlf.constantMultilineString ? true : null; - const c8 = - crlf.constantMultilineString != lf.constantMultilineString ? true : null; - const c9 = - lf.constantMultilineString != cr.constantMultilineString ? true : null; + const c7 = cr.constantMultilineString != crlf.constantMultilineString + ? true + : null; + const c8 = crlf.constantMultilineString != lf.constantMultilineString + ? true + : null; + const c9 = lf.constantMultilineString != cr.constantMultilineString + ? true + : null; Expect.isNull(c7); Expect.isNull(c8); Expect.isNull(c9); @@ -118,11 +112,4 @@ main() { // constants is similar to the runtime evaluation tested above. For tools // like the analyzer, this ensures that evaluation is tested (there's no // runtime evaluation). - - - - - - - } diff --git a/tests/language/string/multiline_newline_test.dart b/tests/language/string/multiline_newline_test.dart index cafa05e3dbe..91df275e492 100644 --- a/tests/language/string/multiline_newline_test.dart +++ b/tests/language/string/multiline_newline_test.dart @@ -37,18 +37,27 @@ main() { Expect.equals(lf.nonConstantMultilineString, cr.nonConstantMultilineString); Expect.equals( - cr.nonConstantRawMultilineString, crlf.nonConstantRawMultilineString); + cr.nonConstantRawMultilineString, + crlf.nonConstantRawMultilineString, + ); Expect.equals( - crlf.nonConstantRawMultilineString, lf.nonConstantRawMultilineString); + crlf.nonConstantRawMultilineString, + lf.nonConstantRawMultilineString, + ); Expect.equals( - lf.nonConstantRawMultilineString, cr.nonConstantRawMultilineString); + lf.nonConstantRawMultilineString, + cr.nonConstantRawMultilineString, + ); - const c1 = - cr.constantMultilineString == crlf.constantMultilineString ? true : null; - const c2 = - crlf.constantMultilineString == lf.constantMultilineString ? true : null; - const c3 = - lf.constantMultilineString == cr.constantMultilineString ? true : null; + const c1 = cr.constantMultilineString == crlf.constantMultilineString + ? true + : null; + const c2 = crlf.constantMultilineString == lf.constantMultilineString + ? true + : null; + const c3 = lf.constantMultilineString == cr.constantMultilineString + ? true + : null; Expect.isTrue(c1); Expect.isTrue(c2); Expect.isTrue(c3); @@ -102,12 +111,15 @@ main() { // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't. Expect.equals(3, c6r); - const c7 = - cr.constantMultilineString != crlf.constantMultilineString ? true : null; - const c8 = - crlf.constantMultilineString != lf.constantMultilineString ? true : null; - const c9 = - lf.constantMultilineString != cr.constantMultilineString ? true : null; + const c7 = cr.constantMultilineString != crlf.constantMultilineString + ? true + : null; + const c8 = crlf.constantMultilineString != lf.constantMultilineString + ? true + : null; + const c9 = lf.constantMultilineString != cr.constantMultilineString + ? true + : null; Expect.isNull(c7); Expect.isNull(c8); Expect.isNull(c9); @@ -136,38 +148,32 @@ main() { const c10 = c7 ? 1 : 2; // ^^ // [analyzer] COMPILE_TIME_ERROR.CONST_EVAL_TYPE_BOOL - // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't. - // ^^ // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't. const c11 = c8 ? 2 : 3; // ^^ // [analyzer] COMPILE_TIME_ERROR.CONST_EVAL_TYPE_BOOL - // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't. - // ^^ // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't. const c12 = c9 ? 3 : 4; // ^^ // [analyzer] COMPILE_TIME_ERROR.CONST_EVAL_TYPE_BOOL - // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't. - // ^^ // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't. const c10r = c7r ? 1 : 2; // ^^^ // [analyzer] COMPILE_TIME_ERROR.CONST_EVAL_TYPE_BOOL - // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't. - // ^^^ // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't. const c11r = c8r ? 2 : 3; // ^^^ // [analyzer] COMPILE_TIME_ERROR.CONST_EVAL_TYPE_BOOL - // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't. - // ^^^ // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't. const c12r = c9r ? 3 : 4; // ^^^ // [analyzer] COMPILE_TIME_ERROR.CONST_EVAL_TYPE_BOOL - // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't. - // ^^^ // [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE + // [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't. } diff --git a/tests/language/string/multiline_strings_test.dart b/tests/language/string/multiline_strings_test.dart index fa96fb1bc3c..8795014d32e 100644 --- a/tests/language/string/multiline_strings_test.dart +++ b/tests/language/string/multiline_strings_test.dart @@ -7,64 +7,40 @@ import "package:expect/expect.dart"; main() { - Expect.equals( - 'foo', - ''' + Expect.equals('foo', ''' foo'''); - Expect.equals( - '\\\nfoo', - '''\\ + Expect.equals('\\\nfoo', '''\\ foo'''); - Expect.equals( - '\t\nfoo', - '''\t + Expect.equals('\t\nfoo', '''\t foo'''); - Expect.equals( - 'foo', - '''\ + Expect.equals('foo', '''\ foo'''); - Expect.equals( - 'foo', - '''\ \ + Expect.equals('foo', '''\ \ foo'''); - Expect.equals( - ' \nfoo', - '''\x20 + Expect.equals(' \nfoo', '''\x20 foo'''); String x = ' '; - Expect.equals( - ' \nfoo', - '''$x + Expect.equals(' \nfoo', '''$x foo'''); - Expect.equals( - 'foo', - r''' + Expect.equals('foo', r''' foo'''); - Expect.equals( - '\\\\\nfoo', - r'''\\ + Expect.equals('\\\\\nfoo', r'''\\ foo'''); - Expect.equals( - '\\t\nfoo', - r'''\t + Expect.equals('\\t\nfoo', r'''\t foo'''); - Expect.equals( - 'foo', - r'''\ + Expect.equals('foo', r'''\ foo'''); - Expect.equals( - 'foo', - r'''\ \ + Expect.equals('foo', r'''\ \ foo'''); } diff --git a/tests/language/string/no_operator_runtime_test.dart b/tests/language/string/no_operator_runtime_test.dart index ebf1dc763ea..39c214b186c 100644 --- a/tests/language/string/no_operator_runtime_test.dart +++ b/tests/language/string/no_operator_runtime_test.dart @@ -10,20 +10,4 @@ import 'package:expect/expect.dart'; main() { var x = "x"; var y = "y"; - - - - - - - - - - - - - - - - } diff --git a/tests/language/string/raw_string_test.dart b/tests/language/string/raw_string_test.dart index 358f88200bb..f509678a82b 100644 --- a/tests/language/string/raw_string_test.dart +++ b/tests/language/string/raw_string_test.dart @@ -15,23 +15,15 @@ class RawStringTest { Expect.equals("", r''''''); Expect.equals("''''", r"''''"); Expect.equals('""""', r'""""'); - Expect.equals( - "1\n2\n3", - r"""1 + Expect.equals("1\n2\n3", r"""1 2 3"""); - Expect.equals( - "1\n2\n3", - r'''1 + Expect.equals("1\n2\n3", r'''1 2 3'''); - Expect.equals( - "1", - r""" + Expect.equals("1", r""" 1"""); - Expect.equals( - "1", - r''' + Expect.equals("1", r''' 1'''); Expect.equals("'", r"'"); Expect.equals('"', r'"'); @@ -41,10 +33,14 @@ class RawStringTest { Expect.equals("\\", r"\"); Expect.equals("\\", r'\'); Expect.equals("\${12}", r"${12}"); - Expect.equals("\\a\\b\\c\\d\\e\\f\\g\\h\\i\\j\\k\\l\\m", - r"\a\b\c\d\e\f\g\h\i\j\k\l\m"); - Expect.equals("\\n\\o\\p\\q\\r\\s\\t\\u\\v\\w\\x\\y\\z", - r"\n\o\p\q\r\s\t\u\v\w\x\y\z"); + Expect.equals( + "\\a\\b\\c\\d\\e\\f\\g\\h\\i\\j\\k\\l\\m", + r"\a\b\c\d\e\f\g\h\i\j\k\l\m", + ); + Expect.equals( + "\\n\\o\\p\\q\\r\\s\\t\\u\\v\\w\\x\\y\\z", + r"\n\o\p\q\r\s\t\u\v\w\x\y\z", + ); } } diff --git a/tests/language/string/runtime_test.dart b/tests/language/string/runtime_test.dart index 41a0d8ea9c6..5492354374c 100644 --- a/tests/language/string/runtime_test.dart +++ b/tests/language/string/runtime_test.dart @@ -32,7 +32,6 @@ class StringTest { static testNoSuchMethod() { String a = "Hello"; - } static testCharCodes() { diff --git a/tests/language/string/string_test.dart b/tests/language/string/string_test.dart index dfe4447480d..3a995046620 100644 --- a/tests/language/string/string_test.dart +++ b/tests/language/string/string_test.dart @@ -30,9 +30,9 @@ class StringTest { static testNoSuchMethod() { String a = "Hello"; a[1] = 12; -// ^^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_OPERATOR -// [cfe] The operator '[]=' isn't defined for the class 'String'. + // [error column 6, length 3] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_OPERATOR + // [cfe] The operator '[]=' isn't defined for the class 'String'. } static testCharCodes() { diff --git a/tests/language/string/substring_runtime_test.dart b/tests/language/string/substring_runtime_test.dart index 38007adc731..27de3e8b467 100644 --- a/tests/language/string/substring_runtime_test.dart +++ b/tests/language/string/substring_runtime_test.dart @@ -9,10 +9,7 @@ import "package:expect/expect.dart"; main() { - try { - - - } on TypeError catch (e) { + try {} on TypeError catch (e) { // OK. } on ArgumentError catch (e) { // OK. diff --git a/tests/language/super/assign_runtime_test.dart b/tests/language/super/assign_runtime_test.dart index 77f3ddb0db3..eea3026aec5 100644 --- a/tests/language/super/assign_runtime_test.dart +++ b/tests/language/super/assign_runtime_test.dart @@ -18,5 +18,4 @@ class C extends A { main() { A a = new C(); a.x = 37; - } diff --git a/tests/language/super/call3_runtime_test.dart b/tests/language/super/call3_runtime_test.dart index 1df0b3c20d3..360577215fb 100644 --- a/tests/language/super/call3_runtime_test.dart +++ b/tests/language/super/call3_runtime_test.dart @@ -10,9 +10,7 @@ import "package:expect/expect.dart"; class A { - A( - - ); + A(); final foo = 499; } @@ -25,9 +23,7 @@ class B2 extends A { } class C { - C - - (); + C(); final foo = 499; } diff --git a/tests/language/super/call3_test.dart b/tests/language/super/call3_test.dart index 31bcc302749..4000652d34b 100644 --- a/tests/language/super/call3_test.dart +++ b/tests/language/super/call3_test.dart @@ -7,12 +7,11 @@ import "package:expect/expect.dart"; class A { - A(this.x -// ^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD -// ^ -// [cfe] 'x' isn't an instance field of this class. - ); + A(this.x); + //^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD + // ^ + // [cfe] 'x' isn't an instance field of this class. final foo = 499; } @@ -23,13 +22,13 @@ class B extends A {} class B2 extends A { B2(); -//^^ -// [analyzer] COMPILE_TIME_ERROR.IMPLICIT_SUPER_INITIALIZER_MISSING_ARGUMENTS -// [cfe] The implicitly called unnamed constructor from 'A' has required parameters. + // [error column 3, length 2] + // [analyzer] COMPILE_TIME_ERROR.IMPLICIT_SUPER_INITIALIZER_MISSING_ARGUMENTS + // [cfe] The implicitly called unnamed constructor from 'A' has required parameters. B2.named() : this.x = 499; -//^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.IMPLICIT_SUPER_INITIALIZER_MISSING_ARGUMENTS -// [cfe] The implicitly called unnamed constructor from 'A' has required parameters. + // [error column 3, length 8] + // [analyzer] COMPILE_TIME_ERROR.IMPLICIT_SUPER_INITIALIZER_MISSING_ARGUMENTS + // [cfe] The implicitly called unnamed constructor from 'A' has required parameters. var x; } @@ -45,13 +44,13 @@ class D extends C {} class D2 extends C { D2(); -//^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER -// [cfe] The superclass, 'C', has no unnamed constructor that takes no arguments. + // [error column 3, length 2] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER + // [cfe] The superclass, 'C', has no unnamed constructor that takes no arguments. D2.named() : this.x = 499; -//^^ -// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER -// [cfe] The superclass, 'C', has no unnamed constructor that takes no arguments. + // [error column 3, length 2] + // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER + // [cfe] The superclass, 'C', has no unnamed constructor that takes no arguments. var x; } diff --git a/tests/language/super/conditional_operator_runtime_test.dart b/tests/language/super/conditional_operator_runtime_test.dart index 25296390d89..c65933d743d 100644 --- a/tests/language/super/conditional_operator_runtime_test.dart +++ b/tests/language/super/conditional_operator_runtime_test.dart @@ -15,29 +15,9 @@ class B { } class C extends B { - C() + C(); - ; - - test() { - - - - - - - - - - - - - - - - - - } + test() {} } main() { diff --git a/tests/language/super/field_access_test.dart b/tests/language/super/field_access_test.dart index ffd1897ef9a..0c7bbf225a6 100644 --- a/tests/language/super/field_access_test.dart +++ b/tests/language/super/field_access_test.dart @@ -15,12 +15,8 @@ class A { class B extends A { int foo; B.b1(x, this.foo) : super(x); - B.b2(x, y) - : this.foo = y, - super(x); - B.b3(x, y) - : this.foo = y, - super(x); + B.b2(x, y) : this.foo = y, super(x); + B.b3(x, y) : this.foo = y, super(x); super$foo() => super.foo; sum() => foo + super.foo; diff --git a/tests/language/super/no_such_method4_runtime_legacy_test.dart b/tests/language/super/no_such_method4_runtime_legacy_test.dart index 7d93c3389dd..f7214e3baaa 100644 --- a/tests/language/super/no_such_method4_runtime_legacy_test.dart +++ b/tests/language/super/no_such_method4_runtime_legacy_test.dart @@ -17,8 +17,6 @@ class A { class B extends Object with A { noSuchMethod(im) => 87; - - } main() { diff --git a/tests/language/super/no_such_method5_runtime_legacy_test.dart b/tests/language/super/no_such_method5_runtime_legacy_test.dart index 8f7545e97e2..69819c706d2 100644 --- a/tests/language/super/no_such_method5_runtime_legacy_test.dart +++ b/tests/language/super/no_such_method5_runtime_legacy_test.dart @@ -15,9 +15,7 @@ class A { noSuchMethod(im) => 42; } -class B extends Object with A { - -} +class B extends Object with A {} main() { Expect.equals(42, new B().foo()); diff --git a/tests/language/super/operator_test.dart b/tests/language/super/operator_test.dart index 5953e7acac8..07d0c90338f 100644 --- a/tests/language/super/operator_test.dart +++ b/tests/language/super/operator_test.dart @@ -46,7 +46,6 @@ class B extends A { } } - main() { var a = new A(); a = a + "William"; // operator + of class A. diff --git a/tests/language/super/setter_test.dart b/tests/language/super/setter_test.dart index 3d029066abd..30535ba6d12 100644 --- a/tests/language/super/setter_test.dart +++ b/tests/language/super/setter_test.dart @@ -9,22 +9,26 @@ class Base { Base() {} String value_ = ""; - String get value { return value_; } + String get value { + return value_; + } + set value(String newValue) { value_ = 'Base:$newValue'; } } - class Derived extends Base { Derived() : super() {} set value(String newValue) { super.value = 'Derived:$newValue'; } - String get value { return super.value; } -} + String get value { + return super.value; + } +} class SuperSetterTest { static void testMain() { diff --git a/tests/language/super/super_test.dart b/tests/language/super/super_test.dart index f96f4fec957..ef1b281fb05 100644 --- a/tests/language/super/super_test.dart +++ b/tests/language/super/super_test.dart @@ -28,15 +28,11 @@ main() { class Sup { var x, y, z; - Sup(a, b) - : this.x = a, - this.y = b { + Sup(a, b) : this.x = a, this.y = b { z = a + b; } - Sup.stat() - : this.x = i++, - this.y = i++ { + Sup.stat() : this.x = i++, this.y = i++ { z = i++; } } @@ -44,17 +40,11 @@ class Sup { class Sub extends Sup { var u, v, w; - Sub(a, b) - : this.v = a, - this.w = b, - super(a, b) { + Sub(a, b) : this.v = a, this.w = b, super(a, b) { u = a + b; } - Sub.stat() - : this.v = i++, - this.w = i++, - super.stat() { + Sub.stat() : this.v = i++, this.w = i++, super.stat() { u = i++; } } diff --git a/tests/language/switch/bad_case_legacy_test.dart b/tests/language/switch/bad_case_legacy_test.dart index 82e8b28078f..a4ac4b20322 100644 --- a/tests/language/switch/bad_case_legacy_test.dart +++ b/tests/language/switch/bad_case_legacy_test.dart @@ -33,14 +33,14 @@ caesarSays(n) { archimedesSays(n) { switch (n) { case 3.14: - // ^^^^ - // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS - // [cfe] Case expression '3.14' does not have a primitive operator '=='. + // ^^^^ + // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS + // [cfe] Case expression '3.14' does not have a primitive operator '=='. return "Pi"; case 2.71828: - // ^^^^^^^ - // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS - // [cfe] Case expression '2.71828' does not have a primitive operator '=='. + // ^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS + // [cfe] Case expression '2.71828' does not have a primitive operator '=='. return "Huh?"; } return null; diff --git a/tests/language/switch/bad_case_runtime_test.dart b/tests/language/switch/bad_case_runtime_test.dart index 0119fa51bd5..8cbd2f23a1d 100644 --- a/tests/language/switch/bad_case_runtime_test.dart +++ b/tests/language/switch/bad_case_runtime_test.dart @@ -22,18 +22,10 @@ caesarSays(n) { return "I"; case 4: return "IV"; - - } return null; } archimedesSays(n) { - - - - - - return null; } diff --git a/tests/language/switch/bad_case_test.dart b/tests/language/switch/bad_case_test.dart index 87a9f61c59d..653170afaa9 100644 --- a/tests/language/switch/bad_case_test.dart +++ b/tests/language/switch/bad_case_test.dart @@ -32,14 +32,14 @@ caesarSays(n) { archimedesSays(n) { switch (n) { case 3.14: - // ^^^^ - // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS - // [cfe] Case expression '3.14' does not have a primitive operator '=='. + // ^^^^ + // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS + // [cfe] Case expression '3.14' does not have a primitive operator '=='. return "Pi"; case 2.71828: - // ^^^^^^^ - // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS - // [cfe] Case expression '2.71828' does not have a primitive operator '=='. + // ^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS + // [cfe] Case expression '2.71828' does not have a primitive operator '=='. return "Huh?"; } return null; diff --git a/tests/language/switch/case_expression_with_assignment_test.dart b/tests/language/switch/case_expression_with_assignment_test.dart index 0ce963d727f..fdc3ad711df 100644 --- a/tests/language/switch/case_expression_with_assignment_test.dart +++ b/tests/language/switch/case_expression_with_assignment_test.dart @@ -6,7 +6,6 @@ // Error was in pre-pattern case parsing. // @dart=2.19 - import "package:expect/expect.dart"; const ERROR_A = 0; diff --git a/tests/language/switch/case_fallthrough_legacy_error_test.dart b/tests/language/switch/case_fallthrough_legacy_error_test.dart index 23f4a67d50a..16b8e2af2d5 100644 --- a/tests/language/switch/case_fallthrough_legacy_error_test.dart +++ b/tests/language/switch/case_fallthrough_legacy_error_test.dart @@ -208,24 +208,24 @@ dynamic testSwitchWarn(int x) { } } case 10: - // [error column 9, length 4] - // [analyzer] COMPILE_TIME_ERROR.SWITCH_CASE_COMPLETES_NORMALLY - // [cfe] Switch case may fall through to the next case. + // [error column 9, length 4] + // [analyzer] COMPILE_TIME_ERROR.SWITCH_CASE_COMPLETES_NORMALLY + // [cfe] Switch case may fall through to the next case. while (true) break; // Breaks loop, reaches end. case 11: - // [error column 9, length 4] - // [analyzer] COMPILE_TIME_ERROR.SWITCH_CASE_COMPLETES_NORMALLY - // [cfe] Switch case may fall through to the next case. + // [error column 9, length 4] + // [analyzer] COMPILE_TIME_ERROR.SWITCH_CASE_COMPLETES_NORMALLY + // [cfe] Switch case may fall through to the next case. do break; while (true); // Breaks loop, reaches end. case 12: - // [error column 9, length 4] - // [analyzer] COMPILE_TIME_ERROR.SWITCH_CASE_COMPLETES_NORMALLY - // [cfe] Switch case may fall through to the next case. + // [error column 9, length 4] + // [analyzer] COMPILE_TIME_ERROR.SWITCH_CASE_COMPLETES_NORMALLY + // [cfe] Switch case may fall through to the next case. for (;;) break; // Breaks loop, reaches end. case 13: - // [error column 9, length 4] - // [analyzer] COMPILE_TIME_ERROR.SWITCH_CASE_COMPLETES_NORMALLY - // [cfe] Switch case may fall through to the next case. + // [error column 9, length 4] + // [analyzer] COMPILE_TIME_ERROR.SWITCH_CASE_COMPLETES_NORMALLY + // [cfe] Switch case may fall through to the next case. for (var _ in []) break LOOP; // Can be empty, reaches end. case 14: if (x.isEven) { @@ -236,23 +236,23 @@ dynamic testSwitchWarn(int x) { case 15: (throw 0); // Exits switch. case 16: - // [error column 9, length 4] - // [analyzer] COMPILE_TIME_ERROR.SWITCH_CASE_COMPLETES_NORMALLY - // [cfe] Switch case may fall through to the next case. + // [error column 9, length 4] + // [analyzer] COMPILE_TIME_ERROR.SWITCH_CASE_COMPLETES_NORMALLY + // [cfe] Switch case may fall through to the next case. nop(x); // Reaches end. case 17: L: break; // Breaks and exits switch. case 18: - // [error column 9, length 4] - // [analyzer] COMPILE_TIME_ERROR.SWITCH_CASE_COMPLETES_NORMALLY - // [cfe] Switch case may fall through to the next case. + // [error column 9, length 4] + // [analyzer] COMPILE_TIME_ERROR.SWITCH_CASE_COMPLETES_NORMALLY + // [cfe] Switch case may fall through to the next case. L: break L; // Breaks break statement only, reaches end. case 19: - // [error column 9, length 4] - // [cfe] Switch case may fall through to the next case. - // [analyzer] COMPILE_TIME_ERROR.SWITCH_CASE_COMPLETES_NORMALLY + // [error column 9, length 4] + // [cfe] Switch case may fall through to the next case. + // [analyzer] COMPILE_TIME_ERROR.SWITCH_CASE_COMPLETES_NORMALLY L: if (x.isOdd) { break L; // Breaks if, reaches end. @@ -264,26 +264,30 @@ dynamic testSwitchWarn(int x) { // with any pre-2.12 type. case 20: notEver(x); // Type Never implies not completing. - case 21: { - notEver(x); - } - case 22: { + case 21: { notEver(x); } - } - case 23: { - do { - notEver(x); - } while (true); - } - case 24: { - if (x.isEven) { - notEver(x); - } else { - notEver(-x); + case 22: + { + { + notEver(x); + } + } + case 23: + { + do { + notEver(x); + } while (true); + } + case 24: + { + if (x.isEven) { + notEver(x); + } else { + notEver(-x); + } } - } case 25: nop(x.isEven ? notEver(x) : notEver(-x)); LAST: diff --git a/tests/language/switch/case_fallthrough_test.dart b/tests/language/switch/case_fallthrough_test.dart index f360211e20b..9ba0eafd942 100644 --- a/tests/language/switch/case_fallthrough_test.dart +++ b/tests/language/switch/case_fallthrough_test.dart @@ -191,26 +191,30 @@ dynamic testSwitch(int x) { } case 39: notEver(x); // Type Never implies not completing. - case 40: { - notEver(x); - } - case 41: { + case 40: { notEver(x); } - } - case 42: { - do { - notEver(x); - } while (true); - } - case 43: { - if (x.isEven) { - notEver(x); - } else { - notEver(-x); + case 41: + { + { + notEver(x); + } + } + case 42: + { + do { + notEver(x); + } while (true); + } + case 43: + { + if (x.isEven) { + notEver(x); + } else { + notEver(-x); + } } - } case 44: nop(x.isEven ? notEver(x) : notEver(-x)); LAST: diff --git a/tests/language/switch/case_legacy_test.dart b/tests/language/switch/case_legacy_test.dart index 5219aabb2e2..c3bcde1edc6 100644 --- a/tests/language/switch/case_legacy_test.dart +++ b/tests/language/switch/case_legacy_test.dart @@ -32,11 +32,13 @@ class D implements A { main() { switch (new B()) { - case const A.B() as B: Expect.fail("bad switch"); break; - // ^^^^^^^^^^^^^^^^ - // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS - // ^ - // [cfe] Case expression 'B {}' does not have a primitive operator '=='. + case const A.B() as B: + // ^^^^^^^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS + // ^ + // [cfe] Case expression 'B {}' does not have a primitive operator '=='. + Expect.fail("bad switch"); + break; } switch (new C()) { @@ -49,21 +51,25 @@ main() { case const A.C2() as C: Expect.fail("bad switch"); break; - case const A(): Expect.fail("bad switch"); break; - // ^^^^^^^^^ - // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IS_NOT_SWITCH_EXPRESSION_SUBTYPE - // ^ - // [cfe] Type 'A' of the case expression is not a subtype of type 'C' of this switch expression. + case const A(): + // ^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IS_NOT_SWITCH_EXPRESSION_SUBTYPE + // ^ + // [cfe] Type 'A' of the case expression is not a subtype of type 'C' of this switch expression. + Expect.fail("bad switch"); + break; } switch (new A()) { case const A(): Expect.fail("bad switch"); break; - case const A.B(): Expect.fail("bad switch"); break; - // ^^^^^^^^^^^ - // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS - // ^ - // [cfe] Case expression 'B {}' does not have a primitive operator '=='. + case const A.B(): + // ^^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS + // ^ + // [cfe] Case expression 'B {}' does not have a primitive operator '=='. + Expect.fail("bad switch"); + break; } } diff --git a/tests/language/switch/case_test.dart b/tests/language/switch/case_test.dart index 84d6ce392bc..21fcb523faa 100644 --- a/tests/language/switch/case_test.dart +++ b/tests/language/switch/case_test.dart @@ -33,11 +33,13 @@ class D implements A { main() { switch (new B()) { - case const A.B() as B: Expect.fail("bad switch"); break; - // ^^^^^^^^^^^^^^^^ - // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS - // ^ - // [cfe] Case expression 'B {}' does not have a primitive operator '=='. + case const A.B() as B: + // ^^^^^^^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS + // ^ + // [cfe] Case expression 'B {}' does not have a primitive operator '=='. + Expect.fail("bad switch"); + break; } switch (new C()) { @@ -50,21 +52,25 @@ main() { case const A.C2() as C: Expect.fail("bad switch"); break; - case const A(): Expect.fail("bad switch"); break; - // ^^^^^^^^^ - // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IS_NOT_SWITCH_EXPRESSION_SUBTYPE - // ^ - // [cfe] Type 'A' of the case expression is not a subtype of type 'C' of this switch expression. + case const A(): + // ^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IS_NOT_SWITCH_EXPRESSION_SUBTYPE + // ^ + // [cfe] Type 'A' of the case expression is not a subtype of type 'C' of this switch expression. + Expect.fail("bad switch"); + break; } switch (new A()) { case const A(): Expect.fail("bad switch"); break; - case const A.B(): Expect.fail("bad switch"); break; - // ^^^^^^^^^^^ - // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS - // ^ - // [cfe] Case expression 'B {}' does not have a primitive operator '=='. + case const A.B(): + // ^^^^^^^^^^^ + // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS + // ^ + // [cfe] Case expression 'B {}' does not have a primitive operator '=='. + Expect.fail("bad switch"); + break; } } diff --git a/tests/language/switch/switch4_test.dart b/tests/language/switch/switch4_test.dart index ccd63126e3f..ceaec6bd3a4 100644 --- a/tests/language/switch/switch4_test.dart +++ b/tests/language/switch/switch4_test.dart @@ -11,10 +11,10 @@ main() { case 1: x = 1; continue L; -// ^ -// [cfe] Can't find label 'L'. -// ^ -// [analyzer] COMPILE_TIME_ERROR.LABEL_UNDEFINED + //^ + // [cfe] Can't find label 'L'. + // ^ + // [analyzer] COMPILE_TIME_ERROR.LABEL_UNDEFINED case 6: x = 2; break; diff --git a/tests/language/switch/switch5_test.dart b/tests/language/switch/switch5_test.dart index d026d062568..8db7e947879 100644 --- a/tests/language/switch/switch5_test.dart +++ b/tests/language/switch/switch5_test.dart @@ -15,9 +15,9 @@ main() { case 6: x = 2; break L; - // ^ - // [analyzer] COMPILE_TIME_ERROR.BREAK_LABEL_ON_SWITCH_MEMBER - // [cfe] Can't break to 'L'. + // ^ + // [analyzer] COMPILE_TIME_ERROR.BREAK_LABEL_ON_SWITCH_MEMBER + // [cfe] Can't break to 'L'. default: break; } diff --git a/tests/language/switch/switch7_test.dart b/tests/language/switch/switch7_test.dart index e47d7e56db5..04495503811 100644 --- a/tests/language/switch/switch7_test.dart +++ b/tests/language/switch/switch7_test.dart @@ -12,9 +12,9 @@ main() { L: case 1: // Shadowing another label is OK. break L; // Illegal, can't reference labeled case from break. - // ^ - // [analyzer] COMPILE_TIME_ERROR.BREAK_LABEL_ON_SWITCH_MEMBER - // [cfe] Can't break to 'L'. + // ^ + // [analyzer] COMPILE_TIME_ERROR.BREAK_LABEL_ON_SWITCH_MEMBER + // [cfe] Can't break to 'L'. } } } diff --git a/tests/language/symbol/literal_runtime_1_test.dart b/tests/language/symbol/literal_runtime_1_test.dart index e574d8cd132..2315af2ad99 100644 --- a/tests/language/symbol/literal_runtime_1_test.dart +++ b/tests/language/symbol/literal_runtime_1_test.dart @@ -47,5 +47,4 @@ main() { Expect.equals(1, m[#B]); // Tries to call the symbol literal #a.toString - } diff --git a/tests/language/symbol/literal_runtime_test.dart b/tests/language/symbol/literal_runtime_test.dart index 5bc7eed589f..15d87f20ec2 100644 --- a/tests/language/symbol/literal_runtime_test.dart +++ b/tests/language/symbol/literal_runtime_test.dart @@ -47,5 +47,4 @@ main() { Expect.equals(1, m[#B]); // Tries to call the symbol literal #a.toString - } diff --git a/tests/language/sync_star/generator1_runtime_test.dart b/tests/language/sync_star/generator1_runtime_test.dart index 728a800eac1..0eed891951a 100644 --- a/tests/language/sync_star/generator1_runtime_test.dart +++ b/tests/language/sync_star/generator1_runtime_test.dart @@ -49,7 +49,6 @@ einsZwei() sync* { dreiVier() sync* { // Throws type error: yielded object is not an iterable. - } main() { @@ -84,7 +83,5 @@ main() { print(einsZwei()); Expect.equals("(1, 2, 3, 5, [6])", einsZwei().toString()); - - } } diff --git a/tests/language/sync_star/sync_star_exception_iterator_test.dart b/tests/language/sync_star/sync_star_exception_iterator_test.dart index 22d36d107d4..d21f2e93166 100644 --- a/tests/language/sync_star/sync_star_exception_iterator_test.dart +++ b/tests/language/sync_star/sync_star_exception_iterator_test.dart @@ -89,8 +89,9 @@ main() { Expect.isTrue(iterator.moveNext()); Expect.equals(100, iterator.current); Expect.equals( - '[main.f2.p.y*1][main.f2.p.f1.a][main.f2.catch:iterator@main.f2.p.f1.a]', - log); + '[main.f2.p.y*1][main.f2.p.f1.a][main.f2.catch:iterator@main.f2.p.f1.a]', + log, + ); log = ''; Expect.isFalse(iterator.moveNext()); Expect.equals('[main.f2.done]', log); @@ -101,7 +102,9 @@ main() { final iterator = f3('main').iterator; Expect.isFalse(iterator.moveNext()); Expect.equals( - '[main.f3.f][main.f3.catch:iterator@main.f3.f][main.f3.done]', log); + '[main.f3.f][main.f3.catch:iterator@main.f3.f][main.f3.done]', + log, + ); } { @@ -110,11 +113,12 @@ main() { Expect.isTrue(iterator.moveNext()); Expect.equals(200, iterator.current); Expect.equals( - '[M.f4.s.y*1]' - '[M.f4.s.f3.f][M.f4.s.f3.catch:iterator@M.f4.s.f3.f][M.f4.s.f3.done]' - '[M.f4.s.y*2]' - '[M.f4.t.f3.f][M.f4.t.f3.catch:iterator@M.f4.t.f3.f][M.f4.t.f3.done]', - log); + '[M.f4.s.y*1]' + '[M.f4.s.f3.f][M.f4.s.f3.catch:iterator@M.f4.s.f3.f][M.f4.s.f3.done]' + '[M.f4.s.y*2]' + '[M.f4.t.f3.f][M.f4.t.f3.catch:iterator@M.f4.t.f3.f][M.f4.t.f3.done]', + log, + ); log = ''; Expect.isFalse(iterator.moveNext()); Expect.equals('[M.f4.done]', log); diff --git a/tests/language/sync_star/void_sync_star_test.dart b/tests/language/sync_star/void_sync_star_test.dart index 4c387f37896..5c1172b4b65 100644 --- a/tests/language/sync_star/void_sync_star_test.dart +++ b/tests/language/sync_star/void_sync_star_test.dart @@ -4,31 +4,35 @@ // It is an error for a `sync*` function to have return type `void`. -/*space*/ void f1() sync* { - // ^^^^ - // [analyzer] unspecified - // [cfe] unspecified +void f1() sync* { + // [error column 1, length 4] + // [analyzer] COMPILE_TIME_ERROR.ILLEGAL_SYNC_GENERATOR_RETURN_TYPE + // ^ + // [cfe] Functions marked 'sync*' can't have return type 'void'. } class C { static void f2() sync* { // ^^^^ - // [analyzer] unspecified - // [cfe] unspecified + // [analyzer] COMPILE_TIME_ERROR.ILLEGAL_SYNC_GENERATOR_RETURN_TYPE + // ^ + // [cfe] Functions marked 'sync*' can't have return type 'void'. } - /*space*/ void f3() sync* { - // ^^^^ - // [analyzer] unspecified - // [cfe] unspecified + void f3() sync* { + // [error column 3, length 4] + // [analyzer] COMPILE_TIME_ERROR.ILLEGAL_SYNC_GENERATOR_RETURN_TYPE + // ^ + // [cfe] Functions marked 'sync*' can't have return type 'void'. } } void main() { - /*space*/ void f4() sync* { - // ^^^^ - // [analyzer] unspecified - // [cfe] unspecified + void f4() sync* { + // [error column 3, length 4] + // [analyzer] COMPILE_TIME_ERROR.ILLEGAL_SYNC_GENERATOR_RETURN_TYPE + // ^ + // [cfe] Functions marked 'sync*' can't have return type 'void'. } // No function literal: It is probably not possible to infer the diff --git a/tests/language/sync_star/yield_star_pause_test.dart b/tests/language/sync_star/yield_star_pause_test.dart index bc2fcb3735c..205a1df325d 100644 --- a/tests/language/sync_star/yield_star_pause_test.dart +++ b/tests/language/sync_star/yield_star_pause_test.dart @@ -14,14 +14,17 @@ main() { var c = new Completer(); var s = yieldStream(mkStream()); var sub; - sub = s.listen((v) { - sub.pause(); - print(v); - Timer.run(sub.resume); - }, onDone: () { - print("DONE"); - c.complete(null); - }); + sub = s.listen( + (v) { + sub.pause(); + print(v); + Timer.run(sub.resume); + }, + onDone: () { + print("DONE"); + c.complete(null); + }, + ); return c.future; }); } diff --git a/tests/language/syntax/statement_test.dart b/tests/language/syntax/statement_test.dart index f1b8a463827..9b05080ccc5 100644 --- a/tests/language/syntax/statement_test.dart +++ b/tests/language/syntax/statement_test.dart @@ -68,7 +68,7 @@ class StatementTest { Expect.equals(5, count); // For loop with no test. - for (count = 0;; ++count) { + for (count = 0; ; ++count) { if (count == 10) { break; } @@ -164,7 +164,7 @@ class StatementTest { var ints = [ [32, 87, 3, 589], [12, 1076, 2000, 8], - [622, 127, 77, 955] + [622, 127, 77, 955], ]; int i, j = 0; bool foundIt = false; diff --git a/tests/language/syntax/syntax_native_test.dart b/tests/language/syntax/syntax_native_test.dart index 72db71d5295..3b333e13102 100644 --- a/tests/language/syntax/syntax_native_test.dart +++ b/tests/language/syntax/syntax_native_test.dart @@ -32,9 +32,9 @@ class _JSON native 'JSON' {} // [cfe] expect cfe to report an error here class ListFactory implements List native "Array" { -// ^^^^^^^^^^^^^^ -// [analyzer] SYNTACTIC_ERROR.NATIVE_CLAUSE_IN_NON_SDK_CODE -// [cfe] expect cfe to report an error here + // ^^^^^^^^^^^^^^ + // [analyzer] SYNTACTIC_ERROR.NATIVE_CLAUSE_IN_NON_SDK_CODE + // [cfe] expect cfe to report an error here noSuchMethod(_) => null; // Allow unimplemented methods }