Chromium Code Reviews| Index: pkg/analyzer/test/generated/compile_time_error_code_test.dart |
| diff --git a/pkg/analyzer/test/generated/compile_time_error_code_test.dart b/pkg/analyzer/test/generated/compile_time_error_code_test.dart |
| index 454595b81e4ab67b9fad2356c8ef5d2b3ec670f7..2000ecacd5738273bdf5b3e68ce59347f8146ec8 100644 |
| --- a/pkg/analyzer/test/generated/compile_time_error_code_test.dart |
| +++ b/pkg/analyzer/test/generated/compile_time_error_code_test.dart |
| @@ -32,6 +32,7 @@ class CompileTimeErrorCodeTest extends ResolverTestCase { |
| f(x) { |
| return await x; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT]); |
| verify([source]); |
| } |
| @@ -44,6 +45,7 @@ f(x) { |
| f(x) sync* { |
| yield await x; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT]); |
| verify([source]); |
| } |
| @@ -54,6 +56,7 @@ class C { |
| const C(); |
| } |
| f() { return const C(); }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.CONST_CONSTRUCTOR_THROWS_EXCEPTION]); |
| verify([source]); |
| @@ -67,6 +70,7 @@ class A { |
| int async; |
| } |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INVALID_IDENTIFIER_IN_ASYNC]); |
| verify([source]); |
| @@ -80,6 +84,7 @@ class A { |
| int await; |
| } |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INVALID_IDENTIFIER_IN_ASYNC]); |
| verify([source]); |
| @@ -93,6 +98,7 @@ class A { |
| int yield; |
| } |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INVALID_IDENTIFIER_IN_ASYNC]); |
| verify([source]); |
| @@ -104,6 +110,7 @@ class A { |
| A() {} |
| } |
| class B extends Object mixin A {}'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]); |
| verify([source]); |
| @@ -114,6 +121,7 @@ class B extends Object mixin A {}'''); |
| Source source = addSource(r''' |
| var A; |
| class B extends Object mixin A {}'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_NON_CLASS]); |
| verify([source]); |
| } |
| @@ -121,6 +129,7 @@ class B extends Object mixin A {}'''); |
| fail_objectCannotExtendAnotherClass() async { |
| Source source = addSource(r''' |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.OBJECT_CANNOT_EXTEND_ANOTHER_CLASS]); |
| verify([source]); |
| @@ -129,6 +138,7 @@ class B extends Object mixin A {}'''); |
| fail_superInitializerInObject() async { |
| Source source = addSource(r''' |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.SUPER_INITIALIZER_IN_OBJECT]); |
| verify([source]); |
| @@ -141,6 +151,7 @@ class B extends Object mixin A {}'''); |
| f() async { |
| yield* 0; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.YIELD_EACH_IN_NON_GENERATOR]); |
| verify([source]); |
| @@ -153,6 +164,7 @@ f() async { |
| f() { |
| yield* 0; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.YIELD_IN_NON_GENERATOR]); |
| verify([source]); |
| } |
| @@ -164,6 +176,7 @@ f() { |
| f() async { |
| yield 0; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.YIELD_IN_NON_GENERATOR]); |
| verify([source]); |
| } |
| @@ -175,6 +188,7 @@ f() async { |
| f() { |
| yield 0; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.YIELD_EACH_IN_NON_GENERATOR]); |
| verify([source]); |
| @@ -186,6 +200,7 @@ enum E { ONE } |
| String name(E e) { |
| return e._name; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.ACCESS_PRIVATE_ENUM_FIELD]); |
| // Cannot verify because "_name" cannot be resolved. |
| @@ -206,6 +221,7 @@ class N {}'''); |
| r''' |
| library lib2; |
| class N {}'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.AMBIGUOUS_EXPORT]); |
| verify([source]); |
| } |
| @@ -223,6 +239,7 @@ const Property property = const Property(42); |
| main() { |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.ANNOTATION_WITH_NON_CLASS]); |
| verify([source]); |
| @@ -245,6 +262,7 @@ import 'annotations.dart' as pref; |
| main() { |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.ANNOTATION_WITH_NON_CLASS]); |
| verify([source]); |
| @@ -258,6 +276,7 @@ f() async { |
| g(0); |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]); |
| verify([source]); |
| @@ -271,6 +290,7 @@ f() async { |
| new C().g(async: 0); |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]); |
| // Note: we don't call verify([source]) because verify() doesn't understand |
| @@ -283,6 +303,7 @@ f() async { |
| var async = 1; |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]); |
| verify([source]); |
| @@ -294,6 +315,7 @@ f() async* { |
| var async = 1; |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]); |
| verify([source]); |
| @@ -307,6 +329,7 @@ f() async { |
| } |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER, |
| CompileTimeErrorCode.LABEL_UNDEFINED |
| @@ -324,6 +347,7 @@ f() async { |
| return new C()..async(); |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]); |
| verify([source]); |
| @@ -338,6 +362,7 @@ f() async { |
| return new C()..async = 1; |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]); |
| verify([source]); |
| @@ -352,6 +377,7 @@ f() async { |
| } catch (async) { } |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]); |
| verify([source]); |
| @@ -366,6 +392,7 @@ f() async { |
| } catch (e, async) { } |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]); |
| verify([source]); |
| @@ -379,6 +406,7 @@ f() async { |
| } |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER, |
| CompileTimeErrorCode.LABEL_UNDEFINED |
| @@ -394,6 +422,7 @@ f() async { |
| for (async in []) {} |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]); |
| verify([source]); |
| @@ -406,6 +435,7 @@ f() async { |
| g(0); |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]); |
| verify([source]); |
| @@ -420,6 +450,7 @@ f() async { |
| return new C().async; |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]); |
| verify([source]); |
| @@ -434,6 +465,7 @@ f() async { |
| return new C().async(); |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]); |
| verify([source]); |
| @@ -445,6 +477,7 @@ f() async { |
| int async() => null; |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]); |
| verify([source]); |
| @@ -457,6 +490,7 @@ f() async { |
| return new async.Future.value(0); |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]); |
| verify([source]); |
| @@ -471,6 +505,7 @@ f() async { |
| new C().async = 1; |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]); |
| verify([source]); |
| @@ -483,6 +518,7 @@ f() async { |
| } |
| g() {} |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]); |
| verify([source]); |
| @@ -495,6 +531,7 @@ f() async { |
| return "$async"; |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]); |
| verify([source]); |
| @@ -513,6 +550,7 @@ f() async { |
| return l.async; |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]); |
| verify([source]); |
| @@ -526,6 +564,7 @@ f() async { |
| } |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]); |
| verify([source]); |
| @@ -537,6 +576,7 @@ f() sync* { |
| var async = 1; |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]); |
| verify([source]); |
| @@ -548,6 +588,7 @@ f(list) { |
| await for (var e in list) { |
| } |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.ASYNC_FOR_IN_WRONG_CONTEXT]); |
| verify([source]); |
| @@ -559,6 +600,7 @@ f() async { |
| var await = 1; |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]); |
| verify([source]); |
| @@ -570,6 +612,7 @@ f() async* { |
| var await = 1; |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]); |
| verify([source]); |
| @@ -581,6 +624,7 @@ f() sync* { |
| var await = 1; |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]); |
| verify([source]); |
| @@ -595,6 +639,7 @@ class B { |
| dynamic @A(const A()) x; |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| ParserErrorCode.EXPECTED_CLASS_MEMBER, |
| ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE |
| @@ -607,6 +652,7 @@ class B { |
| class A {} |
| class B {} |
| class as = A with B;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME]); |
| verify([source]); |
| @@ -618,6 +664,7 @@ class A { |
| var x; |
| A(static this.x); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE]); |
| verify([source]); |
| @@ -627,6 +674,7 @@ class A { |
| Source source = addSource(r''' |
| f(static x) { |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE]); |
| verify([source]); |
| @@ -637,6 +685,7 @@ f(static x) { |
| f() { |
| typedef x; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE]); |
| verify([source]); |
| @@ -644,6 +693,7 @@ f() { |
| test_builtInIdentifierAsTypedefName_functionTypeAlias() async { |
| Source source = addSource("typedef bool as();"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME]); |
| verify([source]); |
| @@ -651,6 +701,7 @@ f() { |
| test_builtInIdentifierAsTypeName() async { |
| Source source = addSource("class as {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME]); |
| verify([source]); |
| @@ -658,6 +709,7 @@ f() { |
| test_builtInIdentifierAsTypeParameterName() async { |
| Source source = addSource("class A<as> {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME]); |
| verify([source]); |
| @@ -680,6 +732,7 @@ f(var a) { |
| default: return 0; |
| } |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS]); |
| verify([source]); |
| @@ -691,6 +744,7 @@ class A { |
| int x; |
| A.x() {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD]); |
| verify([source]); |
| @@ -702,6 +756,7 @@ class A { |
| const A.x(); |
| void x() {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD]); |
| verify([source]); |
| @@ -715,6 +770,7 @@ class A { |
| class B extends A { |
| m() {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD]); |
| verify([source]); |
| @@ -728,6 +784,7 @@ class A { |
| class B extends A { |
| m() {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD]); |
| verify([source]); |
| @@ -741,6 +798,7 @@ class A { |
| class B extends A { |
| int m; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER]); |
| verify([source]); |
| @@ -754,6 +812,7 @@ class A { |
| class B extends A { |
| get m => 0; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER]); |
| verify([source]); |
| @@ -763,6 +822,7 @@ class B extends A { |
| Source source = addSource(r''' |
| class T<T> { |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_CLASS]); |
| verify([source]); |
| @@ -773,6 +833,7 @@ class T<T> { |
| class A<T> { |
| var T; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER]); |
| verify([source]); |
| @@ -783,6 +844,7 @@ class A<T> { |
| class A<T> { |
| get T => null; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER]); |
| verify([source]); |
| @@ -793,6 +855,7 @@ class A<T> { |
| class A<T> { |
| T() {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER]); |
| verify([source]); |
| @@ -803,6 +866,7 @@ class A<T> { |
| class A<T> { |
| static T() {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER]); |
| verify([source]); |
| @@ -813,6 +877,7 @@ class A<T> { |
| class A<T> { |
| set T(x) {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER]); |
| verify([source]); |
| @@ -838,6 +903,7 @@ foo(var p) { |
| break; |
| } |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertNoErrors(source); |
| verify([source]); |
| } |
| @@ -853,6 +919,7 @@ int f() { |
| }'''); |
| // TODO(paulberry): the error CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE is |
| // redundant and ought to be suppressed. |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode |
| .CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST, |
| @@ -870,6 +937,7 @@ class A { |
| int f() { |
| return 3; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertNoErrors(source); |
| verify([source]); |
| } |
| @@ -881,6 +949,7 @@ class M { |
| class A extends Object with M { |
| const A(); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_MIXIN]); |
| verify([source]); |
| @@ -894,6 +963,7 @@ class A { |
| class B extends A { |
| const B(): super(); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER]); |
| verify([source]); |
| @@ -907,6 +977,7 @@ class A { |
| class B extends A { |
| const B(); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER]); |
| verify([source]); |
| @@ -920,6 +991,7 @@ class A { |
| class B extends Object with A { |
| const B(); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_MIXIN, |
| CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD |
| @@ -935,6 +1007,7 @@ class A { |
| class B extends A { |
| const B(); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD, |
| CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER |
| @@ -948,6 +1021,7 @@ class A { |
| int x; |
| const A(); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD]); |
| verify([source]); |
| @@ -995,6 +1069,7 @@ class A { |
| const A(); |
| } |
| const a = new A();'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]); |
| verify([source]); |
| @@ -1008,6 +1083,7 @@ class A { |
| external factory const A(); |
| } |
| const x = const A();'''); |
| + await computeAnalysisResult(source); |
| await assertNoErrors(source); |
| verify([source]); |
| } |
| @@ -1020,6 +1096,7 @@ class C<T> { |
| } |
| const x = const C().t;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]); |
| verify([source]); |
| @@ -1033,6 +1110,7 @@ class A { |
| } |
| final a = const A(); |
| const C = a.m;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]); |
| verify([source]); |
| @@ -1050,6 +1128,7 @@ const C = a.m;'''); |
| test_constEvalThrowsException_divisionByZero() async { |
| Source source = addSource("const C = 1 ~/ 0;"); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_THROWS_IDBZE]); |
| verify([source]); |
| } |
| @@ -1066,6 +1145,7 @@ class C { |
| } |
| var x = const C(); |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION, |
| StaticWarningCode.FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION |
| @@ -1086,6 +1166,7 @@ class C { |
| } |
| var x = const C(2); |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION, |
| StaticWarningCode.FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR |
| @@ -1095,6 +1176,7 @@ var x = const C(2); |
| test_constEvalThrowsException_unaryBitNot_null() async { |
| Source source = addSource("const C = ~null;"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]); |
| // no verify(), '~null' is not resolved |
| @@ -1102,6 +1184,7 @@ var x = const C(2); |
| test_constEvalThrowsException_unaryNegated_null() async { |
| Source source = addSource("const C = -null;"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]); |
| // no verify(), '-null' is not resolved |
| @@ -1109,6 +1192,7 @@ var x = const C(2); |
| test_constEvalThrowsException_unaryNot_null() async { |
| Source source = addSource("const C = !null;"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]); |
| verify([source]); |
| @@ -1121,6 +1205,7 @@ var x = const C(2); |
| test_constEvalTypeBool_binary_leftTrue() async { |
| Source source = addSource("const C = (true || 0);"); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL, |
| StaticTypeWarningCode.NON_BOOL_OPERAND, |
| @@ -1138,6 +1223,7 @@ class B { |
| final a; |
| const B(num p) : a = p == const A(); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL_NUM_STRING]); |
| verify([source]); |
| @@ -1152,6 +1238,7 @@ class B { |
| final a; |
| const B(String p) : a = p != const A(); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL_NUM_STRING]); |
| verify([source]); |
| @@ -1184,12 +1271,14 @@ class A { |
| var x; |
| A(const this.x) {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.CONST_FORMAL_PARAMETER]); |
| verify([source]); |
| } |
| test_constFormalParameter_simpleFormalParameter() async { |
| Source source = addSource("f(const x) {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.CONST_FORMAL_PARAMETER]); |
| verify([source]); |
| } |
| @@ -1199,6 +1288,7 @@ class A { |
| f(p) { |
| const C = p; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]); |
| verify([source]); |
| @@ -1213,6 +1303,7 @@ class Foo { |
| foo([int x = field]) {} |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]); |
| verify([source]); |
| @@ -1220,6 +1311,7 @@ class Foo { |
| test_constInitializedWithNonConstValue_missingConstInListLiteral() async { |
| Source source = addSource("const List L = [0];"); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]); |
| verify([source]); |
| @@ -1227,6 +1319,7 @@ class Foo { |
| test_constInitializedWithNonConstValue_missingConstInMapLiteral() async { |
| Source source = addSource("const Map M = {'a' : 0};"); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]); |
| verify([source]); |
| @@ -1267,6 +1360,7 @@ const B = a.V + 1;''' |
| class C { |
| const int f = 0; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.CONST_INSTANCE_FIELD]); |
| verify([source]); |
| } |
| @@ -1280,6 +1374,7 @@ class A { |
| main() { |
| const {const A() : 0}; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS]); |
| verify([source]); |
| @@ -1300,6 +1395,7 @@ class B { |
| main() { |
| const {B.a : 0}; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS]); |
| verify([source]); |
| @@ -1318,6 +1414,7 @@ class B implements A { |
| main() { |
| var m = const { const A(): 42 }; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS]); |
| verify([source]); |
| @@ -1335,6 +1432,7 @@ class B extends A { |
| main() { |
| const {const B() : 0}; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS]); |
| verify([source]); |
| @@ -1346,6 +1444,7 @@ class A { |
| const A(); |
| } |
| f() { return const A<A>(); }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS]); |
| verify([source]); |
| @@ -1360,6 +1459,7 @@ class C<K, V> { |
| f(p) { |
| return const C<A>(); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS]); |
| verify([source]); |
| @@ -1374,6 +1474,7 @@ class C<E> { |
| f(p) { |
| return const C<A, A>(); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS]); |
| verify([source]); |
| @@ -1385,6 +1486,7 @@ class T { |
| T(a, b, {c, d}) {} |
| } |
| f() { return const T(0, 1, c: 2, d: 3); }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.CONST_WITH_NON_CONST]); |
| verify([source]); |
| } |
| @@ -1401,6 +1503,7 @@ main() { |
| print(x); |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.CONST_WITH_NON_CONST]); |
| verify([source]); |
| } |
| @@ -1414,6 +1517,7 @@ var v = 42; |
| @A(v) |
| main() { |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.CONST_WITH_NON_CONSTANT_ARGUMENT]); |
| verify([source]); |
| @@ -1427,6 +1531,7 @@ class A { |
| f(p) { return const A(p); }'''); |
| // TODO(paulberry): the error INVALID_CONSTAT is redundant and ought to be |
| // suppressed. |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.CONST_WITH_NON_CONSTANT_ARGUMENT, |
| CompileTimeErrorCode.INVALID_CONSTANT |
| @@ -1440,6 +1545,7 @@ int A; |
| f() { |
| return const A(); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.CONST_WITH_NON_TYPE]); |
| verify([source]); |
| } |
| @@ -1453,8 +1559,9 @@ import 'lib.dart' as lib; |
| void f() { |
| const lib.A(); |
| }'''); |
| + await computeAnalysisResult(source1); |
| + await computeAnalysisResult(source2); |
| await assertErrors(source2, [CompileTimeErrorCode.CONST_WITH_NON_TYPE]); |
|
Brian Wilkerson
2017/01/10 20:53:34
We have typically added a comment explaining why w
scheglov
2017/01/10 20:57:16
I removed this line accidentally.
Restored.
|
| - verify([source1]); |
| } |
| test_constWithTypeParameters_direct() async { |
| @@ -1463,6 +1570,7 @@ class A<T> { |
| static const V = const A<T>(); |
| const A(); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS, |
| StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC |
| @@ -1476,6 +1584,7 @@ class A<T> { |
| static const V = const A<List<T>>(); |
| const A(); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS, |
| StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC |
| @@ -1491,6 +1600,7 @@ class A { |
| f() { |
| return const A.noSuchConstructor(); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR]); |
| // no verify(), 'noSuchConstructor' is not resolved |
| @@ -1504,6 +1614,7 @@ class A { |
| f() { |
| return const A(); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT]); |
| verify([source]); |
| @@ -1511,6 +1622,7 @@ f() { |
| test_defaultValueInFunctionTypeAlias() async { |
| Source source = addSource("typedef F([x = 0]);"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS]); |
| verify([source]); |
| @@ -1518,6 +1630,7 @@ f() { |
| test_defaultValueInFunctionTypedParameter_named() async { |
| Source source = addSource("f(g({p: null})) {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER]); |
| verify([source]); |
| @@ -1525,6 +1638,7 @@ f() { |
| test_defaultValueInFunctionTypedParameter_optional() async { |
| Source source = addSource("f(g([p = null])) {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER]); |
| verify([source]); |
| @@ -1539,6 +1653,7 @@ class A { |
| class B implements A { |
| B([int x = 1]) {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR |
| ]); |
| @@ -1551,6 +1666,7 @@ class A { |
| A.a() {} |
| A.a() {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_NAME, |
| CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_NAME |
| @@ -1564,6 +1680,7 @@ class A { |
| A() {} |
| A() {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_DEFAULT, |
| CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_DEFAULT |
| @@ -1591,6 +1708,9 @@ class A {}'''); |
| part of lib; |
| class A {}'''); |
| + await computeAnalysisResult(librarySource); |
| + await computeAnalysisResult(sourceA); |
| + await computeAnalysisResult(sourceB); |
| await assertNoErrors(librarySource); |
| await assertErrors(sourceB, [CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| verify([librarySource, sourceA, sourceB]); |
| @@ -1601,6 +1721,7 @@ class A {}'''); |
| main() { |
| try {} catch (e, e) {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| verify([source]); |
| } |
| @@ -1611,6 +1732,7 @@ class A { |
| int a; |
| int a; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| verify([source]); |
| } |
| @@ -1621,6 +1743,7 @@ class A { |
| int x; |
| static int x; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| verify([source]); |
| } |
| @@ -1631,6 +1754,7 @@ class A { |
| m() {} |
| m() {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| verify([source]); |
| } |
| @@ -1647,6 +1771,8 @@ class A {}'''); |
| r''' |
| part of test; |
| class A {}'''); |
| + await computeAnalysisResult(librarySource); |
| + await computeAnalysisResult(sourceA); |
| await assertNoErrors(librarySource); |
| await assertErrors(sourceA, [CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| verify([librarySource, sourceA]); |
| @@ -1661,6 +1787,7 @@ main() { |
| var a; |
| } |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| verify([source]); |
| } |
| @@ -1671,6 +1798,7 @@ main() { |
| int m = 0; |
| m(a) {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| verify([source]); |
| } |
| @@ -1683,6 +1811,7 @@ main(int p) { |
| var a; |
| } |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| verify([source]); |
| } |
| @@ -1695,6 +1824,7 @@ class A { |
| int a; |
| } |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| verify([source]); |
| } |
| @@ -1705,6 +1835,7 @@ class A { |
| int a; |
| A(int a, this.a); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| verify([source]); |
| } |
| @@ -1713,6 +1844,7 @@ class A { |
| Source source = addSource(r''' |
| typedef F(int a, double a); |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| verify([source]); |
| } |
| @@ -1723,6 +1855,7 @@ main() { |
| f(int a, double a) { |
| }; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| verify([source]); |
| } |
| @@ -1733,6 +1866,7 @@ class A { |
| m(int a, double a) { |
| } |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| verify([source]); |
| } |
| @@ -1741,6 +1875,7 @@ class A { |
| Source source = addSource(r''' |
| f(int a, double a) { |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| verify([source]); |
| } |
| @@ -1749,6 +1884,7 @@ f(int a, double a) { |
| Source source = addSource(r''' |
| class A<T, T> { |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| verify([source]); |
| } |
| @@ -1761,6 +1897,7 @@ class A { |
| class B extends A { |
| static int get x => 0; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]); |
| verify([source]); |
| @@ -1774,6 +1911,7 @@ abstract class A { |
| class B extends A { |
| static int get x => 0; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]); |
| verify([source]); |
| @@ -1787,6 +1925,7 @@ class A { |
| class B extends A { |
| static x() {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]); |
| verify([source]); |
| @@ -1800,6 +1939,7 @@ abstract class A { |
| abstract class B extends A { |
| static x() {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]); |
| verify([source]); |
| @@ -1813,6 +1953,7 @@ class A { |
| class B extends A { |
| static set x(value) {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]); |
| verify([source]); |
| @@ -1826,6 +1967,7 @@ abstract class A { |
| class B extends A { |
| static set x(value) {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]); |
| verify([source]); |
| @@ -1837,6 +1979,7 @@ f({a, b}) {} |
| main() { |
| f(a: 1, a: 2); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.DUPLICATE_NAMED_ARGUMENT]); |
| verify([source]); |
| @@ -1849,6 +1992,7 @@ library lib; |
| part 'part.dart'; |
| part 'foo/../part.dart'; |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_PART]); |
| verify([source]); |
| } |
| @@ -1860,12 +2004,14 @@ library lib; |
| part 'part.dart'; |
| part 'part.dart'; |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_PART]); |
| verify([source]); |
| } |
| test_exportInternalLibrary() async { |
| Source source = addSource("export 'dart:_interceptors';"); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.EXPORT_INTERNAL_LIBRARY]); |
| verify([source]); |
| } |
| @@ -1875,6 +2021,7 @@ part 'part.dart'; |
| library L; |
| export 'lib1.dart';'''); |
| addNamedSource("/lib1.dart", "part of lib;"); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.EXPORT_OF_NON_LIBRARY]); |
| verify([source]); |
| } |
| @@ -1910,6 +2057,7 @@ class C = a.A with M;''' |
| test_extendsDisallowedClass_class_bool() async { |
| Source source = addSource("class A extends bool {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, |
| CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT |
| @@ -1919,6 +2067,7 @@ class C = a.A with M;''' |
| test_extendsDisallowedClass_class_double() async { |
| Source source = addSource("class A extends double {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]); |
| verify([source]); |
| @@ -1926,6 +2075,7 @@ class C = a.A with M;''' |
| test_extendsDisallowedClass_class_int() async { |
| Source source = addSource("class A extends int {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, |
| CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT |
| @@ -1935,6 +2085,7 @@ class C = a.A with M;''' |
| test_extendsDisallowedClass_class_Null() async { |
| Source source = addSource("class A extends Null {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, |
| CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT |
| @@ -1944,6 +2095,7 @@ class C = a.A with M;''' |
| test_extendsDisallowedClass_class_num() async { |
| Source source = addSource("class A extends num {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]); |
| verify([source]); |
| @@ -1951,6 +2103,7 @@ class C = a.A with M;''' |
| test_extendsDisallowedClass_class_String() async { |
| Source source = addSource("class A extends String {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, |
| CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT |
| @@ -1962,6 +2115,7 @@ class C = a.A with M;''' |
| Source source = addSource(r''' |
| class M {} |
| class C = bool with M;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]); |
| verify([source]); |
| @@ -1971,6 +2125,7 @@ class C = bool with M;'''); |
| Source source = addSource(r''' |
| class M {} |
| class C = double with M;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]); |
| verify([source]); |
| @@ -1980,6 +2135,7 @@ class C = double with M;'''); |
| Source source = addSource(r''' |
| class M {} |
| class C = int with M;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]); |
| verify([source]); |
| @@ -1989,6 +2145,7 @@ class C = int with M;'''); |
| Source source = addSource(r''' |
| class M {} |
| class C = Null with M;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]); |
| verify([source]); |
| @@ -1998,6 +2155,7 @@ class C = Null with M;'''); |
| Source source = addSource(r''' |
| class M {} |
| class C = num with M;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]); |
| verify([source]); |
| @@ -2007,6 +2165,7 @@ class C = num with M;'''); |
| Source source = addSource(r''' |
| class M {} |
| class C = String with M;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]); |
| verify([source]); |
| @@ -2016,6 +2175,7 @@ class C = String with M;'''); |
| Source source = addSource(r''' |
| enum E { ONE } |
| class A extends E {}'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.EXTENDS_ENUM]); |
| verify([source]); |
| } |
| @@ -2024,12 +2184,14 @@ class A extends E {}'''); |
| Source source = addSource(r''' |
| int A; |
| class B extends A {}'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.EXTENDS_NON_CLASS]); |
| verify([source]); |
| } |
| test_extendsNonClass_dynamic() async { |
| Source source = addSource("class B extends dynamic {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.EXTENDS_NON_CLASS]); |
| verify([source]); |
| } |
| @@ -2042,6 +2204,7 @@ class A { |
| main() { |
| const A(0); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS]); |
| verify([source]); |
| @@ -2055,6 +2218,7 @@ class A { |
| class B extends A { |
| const B() : super(0); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS]); |
| verify([source]); |
| @@ -2066,6 +2230,7 @@ class A { |
| int x; |
| A(this.x) : x = 3 {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER]); |
| verify([source]); |
| @@ -2077,6 +2242,7 @@ class A { |
| int x; |
| A() : x = 0, x = 1 {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS]); |
| verify([source]); |
| @@ -2088,6 +2254,7 @@ class A { |
| int x; |
| A() : x = 0, x = 1, x = 2 {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS, |
| CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS |
| @@ -2102,6 +2269,7 @@ class A { |
| int y; |
| A() : x = 0, x = 1, y = 0, y = 1 {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS, |
| CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS |
| @@ -2115,6 +2283,7 @@ class A { |
| int x; |
| A(this.x) : x = 1 {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER]); |
| verify([source]); |
| @@ -2126,6 +2295,7 @@ class A { |
| int x; |
| factory A(this.x) => null; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.FIELD_INITIALIZER_FACTORY_CONSTRUCTOR]); |
| verify([source]); |
| @@ -2138,6 +2308,7 @@ class A { |
| int x; |
| m(this.x) {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| ParserErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR, |
| CompileTimeErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR |
| @@ -2151,6 +2322,7 @@ class A { |
| int x; |
| m([this.x]) {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR]); |
| verify([source]); |
| @@ -2162,6 +2334,7 @@ class A { |
| int x; |
| A(int p(this.x)); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR]); |
| verify([source]); |
| @@ -2174,6 +2347,7 @@ class A { |
| A.named() {} |
| A() : this.named(), x = 42; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR]); |
| verify([source]); |
| @@ -2186,6 +2360,7 @@ class A { |
| A.named() {} |
| A() : x = 42, this.named(); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR]); |
| verify([source]); |
| @@ -2198,6 +2373,7 @@ class A { |
| A.named() {} |
| A(this.x) : this.named(); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR]); |
| verify([source]); |
| @@ -2209,6 +2385,7 @@ class A { |
| final x; |
| A() : x = 0, x = 0 {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS]); |
| verify([source]); |
| @@ -2228,6 +2405,7 @@ class A { |
| final x; |
| A(this.x) : x = 0 {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER]); |
| verify([source]); |
| @@ -2240,6 +2418,7 @@ class A { |
| A(this.x, this.x) {} |
| }'''); |
| // TODO(brianwilkerson) There should only be one error here. |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.DUPLICATE_DEFINITION, |
| CompileTimeErrorCode.FINAL_INITIALIZED_MULTIPLE_TIMES |
| @@ -2252,12 +2431,14 @@ class A { |
| class A { |
| static const F; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.CONST_NOT_INITIALIZED]); |
| verify([source]); |
| } |
| test_finalNotInitialized_library_const() async { |
| Source source = addSource("const F;"); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.CONST_NOT_INITIALIZED]); |
| verify([source]); |
| } |
| @@ -2267,6 +2448,7 @@ class A { |
| f() { |
| const int x; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.CONST_NOT_INITIALIZED]); |
| verify([source]); |
| } |
| @@ -2275,6 +2457,7 @@ f() { |
| Source source = addSource(r''' |
| var b1 = const bool.fromEnvironment(1); |
| var b2 = const bool.fromEnvironment('x', defaultValue: 1);'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION, |
| StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, |
| @@ -2290,6 +2473,7 @@ var b2 = const bool.fromEnvironment('x', defaultValue: 1);'''); |
| analysisContext2.declaredVariables.define("x", "true"); |
| Source source = |
| addSource("var b = const bool.fromEnvironment('x', defaultValue: 1);"); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION, |
| StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE |
| @@ -2303,6 +2487,7 @@ class A { |
| x(y) {} |
| get x => 0; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.GETTER_AND_METHOD_WITH_SAME_NAME]); |
| verify([source]); |
| @@ -2340,6 +2525,7 @@ class C = B with M implements a.A;''' |
| test_implementsDisallowedClass_class_bool() async { |
| Source source = addSource("class A implements bool {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); |
| verify([source]); |
| @@ -2347,6 +2533,7 @@ class C = B with M implements a.A;''' |
| test_implementsDisallowedClass_class_double() async { |
| Source source = addSource("class A implements double {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); |
| verify([source]); |
| @@ -2354,6 +2541,7 @@ class C = B with M implements a.A;''' |
| test_implementsDisallowedClass_class_int() async { |
| Source source = addSource("class A implements int {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); |
| verify([source]); |
| @@ -2361,6 +2549,7 @@ class C = B with M implements a.A;''' |
| test_implementsDisallowedClass_class_Null() async { |
| Source source = addSource("class A implements Null {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); |
| verify([source]); |
| @@ -2368,6 +2557,7 @@ class C = B with M implements a.A;''' |
| test_implementsDisallowedClass_class_num() async { |
| Source source = addSource("class A implements num {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); |
| verify([source]); |
| @@ -2375,6 +2565,7 @@ class C = B with M implements a.A;''' |
| test_implementsDisallowedClass_class_String() async { |
| Source source = addSource("class A implements String {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); |
| verify([source]); |
| @@ -2382,6 +2573,7 @@ class C = B with M implements a.A;''' |
| test_implementsDisallowedClass_class_String_num() async { |
| Source source = addSource("class A implements String, num {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS, |
| CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS |
| @@ -2394,6 +2586,7 @@ class C = B with M implements a.A;''' |
| class A {} |
| class M {} |
| class C = A with M implements bool;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); |
| verify([source]); |
| @@ -2404,6 +2597,7 @@ class C = A with M implements bool;'''); |
| class A {} |
| class M {} |
| class C = A with M implements double;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); |
| verify([source]); |
| @@ -2414,6 +2608,7 @@ class C = A with M implements double;'''); |
| class A {} |
| class M {} |
| class C = A with M implements int;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); |
| verify([source]); |
| @@ -2424,6 +2619,7 @@ class C = A with M implements int;'''); |
| class A {} |
| class M {} |
| class C = A with M implements Null;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); |
| verify([source]); |
| @@ -2434,6 +2630,7 @@ class C = A with M implements Null;'''); |
| class A {} |
| class M {} |
| class C = A with M implements num;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); |
| verify([source]); |
| @@ -2444,6 +2641,7 @@ class C = A with M implements num;'''); |
| class A {} |
| class M {} |
| class C = A with M implements String;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); |
| verify([source]); |
| @@ -2454,6 +2652,7 @@ class C = A with M implements String;'''); |
| class A {} |
| class M {} |
| class C = A with M implements String, num;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS, |
| CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS |
| @@ -2463,6 +2662,7 @@ class C = A with M implements String, num;'''); |
| test_implementsDynamic() async { |
| Source source = addSource("class A implements dynamic {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DYNAMIC]); |
| verify([source]); |
| } |
| @@ -2471,6 +2671,7 @@ class C = A with M implements String, num;'''); |
| Source source = addSource(r''' |
| enum E { ONE } |
| class A implements E {}'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_ENUM]); |
| verify([source]); |
| } |
| @@ -2479,6 +2680,7 @@ class A implements E {}'''); |
| Source source = addSource(r''' |
| int A; |
| class B implements A {}'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_NON_CLASS]); |
| verify([source]); |
| } |
| @@ -2489,6 +2691,7 @@ class A {} |
| class M {} |
| int B; |
| class C = A with M implements B;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_NON_CLASS]); |
| verify([source]); |
| } |
| @@ -2497,6 +2700,7 @@ class C = A with M implements B;'''); |
| Source source = addSource(r''' |
| class A {} |
| class B implements A, A {}'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_REPEATED]); |
| verify([source]); |
| } |
| @@ -2505,6 +2709,7 @@ class B implements A, A {}'''); |
| Source source = addSource(r''' |
| class A {} class C{} |
| class B implements A, A, A, A {}'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.IMPLEMENTS_REPEATED, |
| CompileTimeErrorCode.IMPLEMENTS_REPEATED, |
| @@ -2517,12 +2722,14 @@ class B implements A, A, A, A {}'''); |
| Source source = addSource(r''' |
| class A {} |
| class B extends A implements A {}'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_SUPER_CLASS]); |
| verify([source]); |
| } |
| test_implementsSuperClass_Object() async { |
| Source source = addSource("class A implements Object {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_SUPER_CLASS]); |
| verify([source]); |
| } |
| @@ -2534,6 +2741,7 @@ class A { |
| A() : v = f; |
| var f; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]); |
| verify([source]); |
| @@ -2545,6 +2753,7 @@ class A { |
| final x = 0; |
| final y = x; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]); |
| verify([source]); |
| @@ -2557,6 +2766,7 @@ class A { |
| A() : v = f(); |
| f() {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]); |
| verify([source]); |
| @@ -2568,6 +2778,7 @@ class A { |
| static var F = m(); |
| m() {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]); |
| verify([source]); |
| @@ -2580,6 +2791,7 @@ class A { |
| A.named() : this(f); |
| var f; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]); |
| verify([source]); |
| @@ -2594,6 +2806,7 @@ class B extends A { |
| B() : super(f); |
| var f; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]); |
| verify([source]); |
| @@ -2606,6 +2819,7 @@ class B extends A { |
| // directive for the error, this is such a minor corner case that we don't |
| // think we should add the additional computation time to figure out such |
| // cases. |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY, HintCode.UNUSED_IMPORT]); |
| verify([source]); |
| @@ -2618,6 +2832,7 @@ class B extends A { |
| // directive for the error, this is such a minor corner case that we don't |
| // think we should add the additional computation time to figure out such |
| // cases. |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY, HintCode.UNUSED_IMPORT]); |
| verify([source]); |
| @@ -2633,6 +2848,7 @@ A a;'''); |
| r''' |
| part of lib; |
| class A{}'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY]); |
| verify([source]); |
| } |
| @@ -2647,6 +2863,7 @@ f(var p) { |
| break; |
| } |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES]); |
| verify([source]); |
| @@ -2672,6 +2889,7 @@ foo(var p) { |
| break; |
| } |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES, |
| CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES |
| @@ -2691,6 +2909,7 @@ f(var p) { |
| break; |
| } |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES, |
| CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES |
| @@ -2706,6 +2925,7 @@ class A { |
| const A() : x = 'foo'; |
| } |
| A a = const A();'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INITIALIZER_FOR_NON_EXISTENT_FIELD]); |
| } |
| @@ -2715,6 +2935,7 @@ A a = const A();'''); |
| class A { |
| A() : x = 0 {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INITIALIZER_FOR_NON_EXISTENT_FIELD]); |
| } |
| @@ -2725,6 +2946,7 @@ class A { |
| static int x; |
| A() : x = 0 {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INITIALIZER_FOR_STATIC_FIELD]); |
| verify([source]); |
| @@ -2735,6 +2957,7 @@ class A { |
| class A { |
| A(this.x) {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD]); |
| verify([source]); |
| @@ -2748,6 +2971,7 @@ int x; |
| class B extends A { |
| B(this.x) {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD]); |
| verify([source]); |
| @@ -2758,6 +2982,7 @@ class B extends A { |
| class A { |
| A([this.x]) {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD]); |
| verify([source]); |
| @@ -2769,6 +2994,7 @@ class A { |
| int get x => 1; |
| A(this.x) {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD]); |
| verify([source]); |
| @@ -2780,6 +3006,7 @@ class A { |
| static int x; |
| A([this.x]) {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_STATIC_FIELD]); |
| verify([source]); |
| @@ -2795,6 +3022,7 @@ class A { |
| return new A(); |
| } |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_FACTORY]); |
| verify([source]); |
| @@ -2810,6 +3038,7 @@ class A { |
| return new A._(); |
| } |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_FACTORY]); |
| verify([source]); |
| @@ -2823,6 +3052,7 @@ class A { |
| f; |
| } |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_STATIC]); |
| verify([source]); |
| @@ -2836,6 +3066,7 @@ class A { |
| g; |
| } |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_STATIC]); |
| verify([source]); |
| @@ -2849,6 +3080,7 @@ class A { |
| m(); |
| } |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_STATIC]); |
| verify([source]); |
| @@ -2860,6 +3092,7 @@ enum E { ONE } |
| E e(String name) { |
| return const E(); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.INSTANTIATE_ENUM]); |
| verify([source]); |
| } |
| @@ -2870,6 +3103,7 @@ enum E { ONE } |
| E e(String name) { |
| return new E(); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.INSTANTIATE_ENUM]); |
| verify([source]); |
| } |
| @@ -2880,6 +3114,7 @@ get V => 0; |
| @V |
| main() { |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]); |
| verify([source]); |
| } |
| @@ -2895,6 +3130,7 @@ import 'lib.dart' as p; |
| @p.V |
| main() { |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]); |
| verify([source]); |
| } |
| @@ -2910,6 +3146,7 @@ import 'lib.dart' as p; |
| @p.V |
| main() { |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]); |
| verify([source]); |
| } |
| @@ -2925,6 +3162,7 @@ import 'lib.dart' as p; |
| @p.V |
| main() { |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]); |
| verify([source]); |
| } |
| @@ -2935,6 +3173,7 @@ final V = 0; |
| @V |
| main() { |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]); |
| verify([source]); |
| } |
| @@ -2945,6 +3184,7 @@ typedef V(); |
| @V |
| main() { |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]); |
| verify([source]); |
| } |
| @@ -2957,6 +3197,7 @@ class A { |
| @A.f |
| main() { |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]); |
| verify([source]); |
| } |
| @@ -2966,6 +3207,7 @@ main() { |
| @unresolved |
| main() { |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]); |
| } |
| @@ -2974,6 +3216,7 @@ main() { |
| @Unresolved() |
| main() { |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]); |
| } |
| @@ -2983,6 +3226,7 @@ import 'dart:math' as p; |
| @p.unresolved |
| main() { |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]); |
| } |
| @@ -2992,6 +3236,7 @@ main() { |
| class A { |
| static const foo = null; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]); |
| } |
| @@ -3047,6 +3292,7 @@ class A { |
| B() : super(); |
| } |
| class B {}'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME]); |
| // no verify() call, "B" is not resolved |
| @@ -3057,6 +3303,7 @@ class B {}'''); |
| class A { |
| B() : super(); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME]); |
| // no verify() call, "B" is not resolved |
| @@ -3068,6 +3315,7 @@ int B; |
| class A { |
| factory B() => null; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INVALID_FACTORY_NAME_NOT_A_CLASS]); |
| verify([source]); |
| @@ -3078,6 +3326,7 @@ class A { |
| class A { |
| factory B() => null; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INVALID_FACTORY_NAME_NOT_A_CLASS]); |
| // no verify() call, "B" is not resolved |
| @@ -3088,6 +3337,7 @@ class A { |
| class A { |
| A() async {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_CONSTRUCTOR]); |
| verify([source]); |
| @@ -3098,6 +3348,7 @@ class A { |
| class A { |
| A() async* {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_CONSTRUCTOR]); |
| verify([source]); |
| @@ -3108,6 +3359,7 @@ class A { |
| class A { |
| A() sync* {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_CONSTRUCTOR]); |
| verify([source]); |
| @@ -3118,6 +3370,7 @@ class A { |
| class A { |
| set x(v) async {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]); |
| verify([source]); |
| @@ -3128,6 +3381,7 @@ class A { |
| class A { |
| set x(v) async* {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]); |
| verify([source]); |
| @@ -3138,6 +3392,7 @@ class A { |
| class A { |
| set x(v) sync* {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]); |
| verify([source]); |
| @@ -3145,6 +3400,7 @@ class A { |
| test_invalidModifierOnSetter_topLevel_async() async { |
| Source source = addSource("set x(v) async {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]); |
| verify([source]); |
| @@ -3152,6 +3408,7 @@ class A { |
| test_invalidModifierOnSetter_topLevel_asyncStar() async { |
| Source source = addSource("set x(v) async* {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]); |
| verify([source]); |
| @@ -3159,6 +3416,7 @@ class A { |
| test_invalidModifierOnSetter_topLevel_syncStar() async { |
| Source source = addSource("set x(v) sync* {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]); |
| verify([source]); |
| @@ -3169,6 +3427,7 @@ class A { |
| class A { |
| factory A() { return this; } |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]); |
| verify([source]); |
| @@ -3180,6 +3439,7 @@ class A { |
| var f; |
| A() : f = this; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]); |
| verify([source]); |
| @@ -3190,6 +3450,7 @@ class A { |
| class A { |
| var f = this; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]); |
| verify([source]); |
| @@ -3200,6 +3461,7 @@ class A { |
| class A { |
| static m() { return this; } |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]); |
| verify([source]); |
| @@ -3210,6 +3472,7 @@ class A { |
| class A { |
| static A f = this; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]); |
| verify([source]); |
| @@ -3223,6 +3486,7 @@ class A { |
| class B extends A { |
| B() : super(this); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]); |
| verify([source]); |
| @@ -3230,6 +3494,7 @@ class B extends A { |
| test_invalidReferenceToThis_topLevelFunction() async { |
| Source source = addSource("f() { return this; }"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]); |
| verify([source]); |
| @@ -3237,6 +3502,7 @@ class B extends A { |
| test_invalidReferenceToThis_variableInitializer() async { |
| Source source = addSource("int x = this;"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]); |
| verify([source]); |
| @@ -3249,6 +3515,7 @@ class A<E> { |
| return const <E>[]; |
| } |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_LIST]); |
| verify([source]); |
| @@ -3261,6 +3528,7 @@ class A<E> { |
| return const <String, E>{}; |
| } |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_MAP]); |
| verify([source]); |
| @@ -3268,11 +3536,13 @@ class A<E> { |
| test_invalidUri_export() async { |
| Source source = addSource("export 'ht:';"); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.INVALID_URI]); |
| } |
| test_invalidUri_import() async { |
| Source source = addSource("import 'ht:';"); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.INVALID_URI]); |
| } |
| @@ -3280,6 +3550,7 @@ class A<E> { |
| Source source = addSource(r''' |
| library lib; |
| part 'ht:';'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.INVALID_URI]); |
| } |
| @@ -3294,6 +3565,7 @@ class Foo<T extends num> { |
| const x = const Foo<int>(const Foo<int>(0, 1), |
| const <Foo<String>>[]); // (1) |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); |
| verify([source]); |
| @@ -3315,6 +3587,7 @@ class Foo { |
| _foo() { |
| } |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]); |
| verify([source]); |
| @@ -3331,6 +3604,7 @@ class A { |
| } |
| } |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.LABEL_IN_OUTER_SCOPE]); |
| // We cannot verify resolution with unresolvable labels |
| } |
| @@ -3342,6 +3616,7 @@ f() { |
| break y; |
| } |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.LABEL_UNDEFINED]); |
| // We cannot verify resolution with undefined labels |
| } |
| @@ -3353,6 +3628,7 @@ f() { |
| continue y; |
| } |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.LABEL_UNDEFINED]); |
| // We cannot verify resolution with undefined labels |
| } |
| @@ -3361,6 +3637,7 @@ f() { |
| // Attempting to compute the length of constant that couldn't be evaluated |
| // (due to an error) should not crash the analyzer (see dartbug.com/23383) |
| Source source = addSource("const int i = (1 ? 'alpha' : 'beta').length;"); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE, |
| CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL, |
| @@ -3374,6 +3651,7 @@ f() { |
| class A { |
| int A = 0; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME]); |
| verify([source]); |
| } |
| @@ -3383,6 +3661,7 @@ class A { |
| class A { |
| int z, A, b = 0; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME]); |
| verify([source]); |
| } |
| @@ -3392,6 +3671,7 @@ class A { |
| class A { |
| get A => 0; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME]); |
| verify([source]); |
| } |
| @@ -3406,6 +3686,7 @@ class A { |
| get x => 0; |
| x(y) {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.METHOD_AND_GETTER_WITH_SAME_NAME]); |
| verify([source]); |
| @@ -3417,6 +3698,7 @@ class A { |
| A() {} |
| } |
| class B extends Object with A {}'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]); |
| verify([source]); |
| @@ -3428,6 +3710,7 @@ class A { |
| A() {} |
| } |
| class B = Object with A;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]); |
| verify([source]); |
| @@ -3470,6 +3753,7 @@ class B { |
| class M {} |
| class C = B with M; |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS]); |
| verify([source]); |
| @@ -3487,6 +3771,7 @@ class C extends B with M {} |
| // generate a further error (despite the fact that it's not forwarded), |
| // since CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS does a better job |
| // of explaining the probem to the user. |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS]); |
| verify([source]); |
| @@ -3506,6 +3791,7 @@ class C extends B with M { |
| // error (despite the fact that it's not forwarded), since |
| // CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS does a better job of |
| // explaining the error to the user. |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS]); |
| verify([source]); |
| @@ -3525,6 +3811,7 @@ class C extends B with M { |
| // error (despite the fact that it's not forwarded), since |
| // CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS does a better job of |
| // explaining the error to the user. |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS]); |
| verify([source]); |
| @@ -3544,6 +3831,7 @@ class C extends B with M { |
| // further error (despite the fact that it's not forwarded), since |
| // CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS does a better job of |
| // explaining the error to the user. |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS]); |
| verify([source]); |
| @@ -3554,6 +3842,7 @@ class C extends B with M { |
| class A {} |
| class B extends A {} |
| class C extends Object with B {}'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]); |
| verify([source]); |
| @@ -3564,6 +3853,7 @@ class C extends Object with B {}'''); |
| class A {} |
| class B extends Object with A {} |
| class C extends Object with B {}'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]); |
| verify([source]); |
| @@ -3574,6 +3864,7 @@ class C extends Object with B {}'''); |
| class A {} |
| class B extends A {} |
| class C = Object with B;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]); |
| verify([source]); |
| @@ -3584,6 +3875,7 @@ class C = Object with B;'''); |
| class A {} |
| class B extends Object with A {} |
| class C = Object with B;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]); |
| verify([source]); |
| @@ -3591,6 +3883,7 @@ class C = Object with B;'''); |
| test_mixinOfDisallowedClass_class_bool() async { |
| Source source = addSource("class A extends Object with bool {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]); |
| verify([source]); |
| @@ -3598,6 +3891,7 @@ class C = Object with B;'''); |
| test_mixinOfDisallowedClass_class_double() async { |
| Source source = addSource("class A extends Object with double {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]); |
| verify([source]); |
| @@ -3605,6 +3899,7 @@ class C = Object with B;'''); |
| test_mixinOfDisallowedClass_class_int() async { |
| Source source = addSource("class A extends Object with int {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]); |
| verify([source]); |
| @@ -3612,6 +3907,7 @@ class C = Object with B;'''); |
| test_mixinOfDisallowedClass_class_Null() async { |
| Source source = addSource("class A extends Object with Null {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]); |
| verify([source]); |
| @@ -3619,6 +3915,7 @@ class C = Object with B;'''); |
| test_mixinOfDisallowedClass_class_num() async { |
| Source source = addSource("class A extends Object with num {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]); |
| verify([source]); |
| @@ -3626,6 +3923,7 @@ class C = Object with B;'''); |
| test_mixinOfDisallowedClass_class_String() async { |
| Source source = addSource("class A extends Object with String {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]); |
| verify([source]); |
| @@ -3635,6 +3933,7 @@ class C = Object with B;'''); |
| Source source = addSource(r''' |
| class A {} |
| class C = A with bool;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]); |
| verify([source]); |
| @@ -3644,6 +3943,7 @@ class C = A with bool;'''); |
| Source source = addSource(r''' |
| class A {} |
| class C = A with double;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]); |
| verify([source]); |
| @@ -3653,6 +3953,7 @@ class C = A with double;'''); |
| Source source = addSource(r''' |
| class A {} |
| class C = A with int;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]); |
| verify([source]); |
| @@ -3662,6 +3963,7 @@ class C = A with int;'''); |
| Source source = addSource(r''' |
| class A {} |
| class C = A with Null;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]); |
| verify([source]); |
| @@ -3671,6 +3973,7 @@ class C = A with Null;'''); |
| Source source = addSource(r''' |
| class A {} |
| class C = A with num;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]); |
| verify([source]); |
| @@ -3680,6 +3983,7 @@ class C = A with num;'''); |
| Source source = addSource(r''' |
| class A {} |
| class C = A with String;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]); |
| verify([source]); |
| @@ -3689,6 +3993,7 @@ class C = A with String;'''); |
| Source source = addSource(r''' |
| class A {} |
| class C = A with String, num;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS, |
| CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS |
| @@ -3700,6 +4005,7 @@ class C = A with String, num;'''); |
| Source source = addSource(r''' |
| enum E { ONE } |
| class A extends Object with E {}'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_ENUM]); |
| verify([source]); |
| } |
| @@ -3708,6 +4014,7 @@ class A extends Object with E {}'''); |
| Source source = addSource(r''' |
| int A; |
| class B extends Object with A {}'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_NON_CLASS]); |
| verify([source]); |
| } |
| @@ -3717,6 +4024,7 @@ class B extends Object with A {}'''); |
| class A {} |
| int B; |
| class C = A with B;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_NON_CLASS]); |
| verify([source]); |
| } |
| @@ -3727,6 +4035,7 @@ class A { |
| toString() => super.toString(); |
| } |
| class B extends Object with A {}'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.MIXIN_REFERENCES_SUPER]); |
| verify([source]); |
| } |
| @@ -3736,6 +4045,7 @@ class B extends Object with A {}'''); |
| int A; |
| class B {} |
| class C extends A with B {}'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.MIXIN_WITH_NON_CLASS_SUPERCLASS]); |
| verify([source]); |
| @@ -3746,6 +4056,7 @@ class C extends A with B {}'''); |
| int A; |
| class B {} |
| class C = A with B;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.MIXIN_WITH_NON_CLASS_SUPERCLASS]); |
| verify([source]); |
| @@ -3758,6 +4069,7 @@ class A { |
| A.a() {} |
| A.b() {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS]); |
| verify([source]); |
| @@ -3769,6 +4081,7 @@ class A {} |
| class B extends A { |
| B() : super(), super() {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.MULTIPLE_SUPER_INITIALIZERS]); |
| verify([source]); |
| @@ -3779,6 +4092,7 @@ class B extends A { |
| // error code is generated through the ErrorVerifier, it is not a |
| // CompileTimeErrorCode. |
| Source source = addSource("class A native 'string' {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [ParserErrorCode.NATIVE_CLAUSE_IN_NON_SDK_CODE]); |
| verify([source]); |
| @@ -3789,6 +4103,7 @@ class B extends A { |
| // error code is generated through the ErrorVerifier, it is not a |
| // CompileTimeErrorCode. |
| Source source = addSource("int m(a) native 'string';"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [ParserErrorCode.NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE]); |
| verify([source]); |
| @@ -3802,6 +4117,7 @@ class B extends A { |
| class A{ |
| static int m(a) native 'string'; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [ParserErrorCode.NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE]); |
| verify([source]); |
| @@ -3815,6 +4131,7 @@ class A { |
| @A |
| main() { |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS]); |
| verify([source]); |
| @@ -3828,6 +4145,7 @@ class A { |
| class B extends A { |
| B() {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT]); |
| verify([source]); |
| @@ -3845,6 +4163,7 @@ class C extends Mixed { |
| C(x) : super(); |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT]); |
| verify([source]); |
| @@ -3862,6 +4181,7 @@ class C extends Mixed { |
| C(); |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT]); |
| verify([source]); |
| @@ -3879,6 +4199,7 @@ class C extends Mixed { |
| C(x) : super.named(); |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER]); |
| // Don't verify since call to super.named() can't be resolved. |
| @@ -3896,6 +4217,7 @@ class C extends Mixed { |
| C(); |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT]); |
| verify([source]); |
| @@ -3912,6 +4234,7 @@ class C extends B with M { |
| C(x) : super(); |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT]); |
| verify([source]); |
| @@ -3928,6 +4251,7 @@ class C extends B with M { |
| C(); |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT]); |
| verify([source]); |
| @@ -3944,6 +4268,7 @@ class C extends B with M { |
| C(x) : super.named(); |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER]); |
| // Don't verify since call to super.named() can't be resolved. |
| @@ -3960,6 +4285,7 @@ class C extends B with M { |
| C(); |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT]); |
| verify([source]); |
| @@ -3975,6 +4301,7 @@ class B { |
| class Mixed = B with M; |
| class C extends Mixed {} |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]); |
| verify([source]); |
| @@ -3990,6 +4317,7 @@ class B { |
| class Mixed = B with M; |
| class C extends Mixed {} |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]); |
| verify([source]); |
| @@ -4004,6 +4332,7 @@ class B { |
| } |
| class C extends B with M {} |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]); |
| verify([source]); |
| @@ -4018,6 +4347,7 @@ class B { |
| } |
| class C extends B with M {} |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]); |
| verify([source]); |
| @@ -4030,6 +4360,7 @@ class A { |
| } |
| class B extends A { |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]); |
| verify([source]); |
| @@ -4039,6 +4370,7 @@ class B extends A { |
| Source source = addSource(r''' |
| class A { A.named() {} } |
| class B extends A {}'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]); |
| verify([source]); |
| @@ -4052,6 +4384,7 @@ class A { |
| @A.fromInt() |
| main() { |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.NON_CONSTANT_ANNOTATION_CONSTRUCTOR]); |
| verify([source]); |
| @@ -4065,6 +4398,7 @@ class A { |
| @A() |
| main() { |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.NON_CONSTANT_ANNOTATION_CONSTRUCTOR]); |
| verify([source]); |
| @@ -4074,6 +4408,7 @@ main() { |
| Source source = addSource(r''' |
| int y; |
| f({x : y}) {}'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]); |
| verify([source]); |
| @@ -4083,6 +4418,7 @@ f({x : y}) {}'''); |
| Source source = addSource(r''' |
| int y; |
| f([x = y]) {}'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]); |
| verify([source]); |
| @@ -4094,6 +4430,7 @@ class A { |
| int y; |
| A({x : y}) {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]); |
| verify([source]); |
| @@ -4105,6 +4442,7 @@ class A { |
| int y; |
| A([x = y]) {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]); |
| verify([source]); |
| @@ -4116,6 +4454,7 @@ class A { |
| int y; |
| m({x : y}) {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]); |
| verify([source]); |
| @@ -4127,6 +4466,7 @@ class A { |
| int y; |
| m([x = y]) {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]); |
| verify([source]); |
| @@ -4168,6 +4508,7 @@ f(int p, int q) { |
| break; |
| } |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.NON_CONSTANT_CASE_EXPRESSION]); |
| verify([source]); |
| @@ -4216,6 +4557,7 @@ main (int p) { |
| f(a) { |
| return const [a]; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.NON_CONSTANT_LIST_ELEMENT]); |
| verify([source]); |
| @@ -4258,6 +4600,7 @@ f() { |
| f() { |
| {'a' : 0, 'b' : 1}.length; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.NON_CONST_MAP_AS_EXPRESSION_STATEMENT]); |
| verify([source]); |
| @@ -4268,6 +4611,7 @@ f() { |
| f() { |
| {'a' : 0, 'b' : 1}; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.NON_CONST_MAP_AS_EXPRESSION_STATEMENT]); |
| verify([source]); |
| @@ -4278,6 +4622,7 @@ f() { |
| f(a) { |
| return const {a : 0}; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_MAP_KEY]); |
| verify([source]); |
| } |
| @@ -4319,6 +4664,7 @@ f() { |
| f(a) { |
| return const {'a' : a}; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE]); |
| verify([source]); |
| } |
| @@ -4361,6 +4707,7 @@ f() { |
| class A { |
| const A(int i) : assert(i.isNegative); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]); |
| verify([source]); |
| @@ -4372,6 +4719,7 @@ class A { |
| class A { |
| const A(int i) : assert(i < 0, 'isNegative = ${i.isNegative}'); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]); |
| verify([source]); |
| @@ -4383,6 +4731,7 @@ class A { |
| final bool a; |
| const A(String p) : a = p && true; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL, |
| StaticTypeWarningCode.NON_BOOL_OPERAND |
| @@ -4396,6 +4745,7 @@ class A { |
| final bool a; |
| const A(String p) : a = true && p; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL, |
| StaticTypeWarningCode.NON_BOOL_OPERAND |
| @@ -4409,6 +4759,7 @@ class A { |
| final int a; |
| const A(String p) : a = 5 & p; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.CONST_EVAL_TYPE_INT, |
| StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE |
| @@ -4422,6 +4773,7 @@ class A { |
| final int a; |
| const A(String p) : a = 5 + p; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.CONST_EVAL_TYPE_NUM, |
| StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE |
| @@ -4436,6 +4788,7 @@ class A { |
| final int a; |
| const A() : a = C; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]); |
| verify([source]); |
| @@ -4453,6 +4806,7 @@ class B { |
| var b = const B();'''); |
| // TODO(paulberry): the error INVALID_CONSTAT is redundant and ought to be |
| // suppressed. |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER, |
| CompileTimeErrorCode.INVALID_CONSTANT |
| @@ -4467,6 +4821,7 @@ class A { |
| const A.named(p); |
| const A() : this.named(C); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]); |
| verify([source]); |
| @@ -4481,6 +4836,7 @@ class B extends A { |
| static var C; |
| const B() : super(C); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]); |
| verify([source]); |
| @@ -4568,6 +4924,7 @@ class A { |
| class B extends A { |
| B() : super.named(); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR]); |
| verify([source]); |
| @@ -4581,6 +4938,7 @@ class A { |
| class B extends A { |
| B(); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR]); |
| verify([source]); |
| @@ -4593,6 +4951,7 @@ class A { |
| } |
| class B extends A { |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR]); |
| verify([source]); |
| @@ -4606,6 +4965,7 @@ class A { |
| main() { |
| const A(); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.NOT_ENOUGH_REQUIRED_ARGUMENTS]); |
| verify([source]); |
| @@ -4619,6 +4979,7 @@ class A { |
| class B extends A { |
| const B() : super(); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.NOT_ENOUGH_REQUIRED_ARGUMENTS]); |
| verify([source]); |
| @@ -4629,6 +4990,7 @@ class B extends A { |
| class A { |
| operator +({p}) {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.OPTIONAL_PARAMETER_IN_OPERATOR]); |
| verify([source]); |
| @@ -4639,6 +5001,7 @@ class A { |
| class A { |
| operator +([p]) {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.OPTIONAL_PARAMETER_IN_OPERATOR]); |
| verify([source]); |
| @@ -4649,6 +5012,7 @@ class A { |
| library l1; |
| part 'l2.dart';'''); |
| addNamedSource("/l2.dart", "library l2;"); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.PART_OF_NON_PART]); |
| verify([source]); |
| } |
| @@ -4657,6 +5021,7 @@ part 'l2.dart';'''); |
| Source source = addSource(r''' |
| library lib; |
| part 'test.dart';'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.PART_OF_NON_PART]); |
| verify([source]); |
| } |
| @@ -4671,6 +5036,7 @@ class C { |
| } |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]); |
| verify([source]); |
| @@ -4684,6 +5050,7 @@ f() { |
| p += 1; |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]); |
| verify([source]); |
| @@ -4699,6 +5066,7 @@ class C { |
| } |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]); |
| verify([source]); |
| @@ -4712,6 +5080,7 @@ f() { |
| p = 1; |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]); |
| verify([source]); |
| @@ -4730,6 +5099,7 @@ f() { |
| p?.g(); |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]); |
| verify([source]); |
| @@ -4747,6 +5117,7 @@ f() { |
| p?.loadLibrary(); |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]); |
| verify([source]); |
| @@ -4765,6 +5136,7 @@ f() { |
| return p?.x; |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]); |
| verify([source]); |
| @@ -4782,6 +5154,7 @@ f() { |
| return p?.loadLibrary; |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]); |
| verify([source]); |
| @@ -4800,6 +5173,7 @@ f() { |
| p?.x = null; |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]); |
| verify([source]); |
| @@ -4817,6 +5191,7 @@ f() { |
| p?.loadLibrary = null; |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]); |
| verify([source]); |
| @@ -4832,6 +5207,7 @@ class C { |
| } |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]); |
| verify([source]); |
| @@ -4845,6 +5221,7 @@ f() { |
| p(); |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]); |
| verify([source]); |
| @@ -4860,6 +5237,7 @@ class A{}'''); |
| import 'lib.dart' as p; |
| typedef p(); |
| p.A a;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER]); |
| verify([source]); |
| @@ -4875,6 +5253,7 @@ class A{}'''); |
| import 'lib.dart' as p; |
| p() {} |
| p.A a;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER]); |
| verify([source]); |
| @@ -4890,6 +5269,7 @@ class A{}'''); |
| import 'lib.dart' as p; |
| var p = null; |
| p.A a;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER]); |
| verify([source]); |
| @@ -4905,6 +5285,7 @@ class A{}'''); |
| import 'lib.dart' as p; |
| class p {} |
| p.A a;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER]); |
| verify([source]); |
| @@ -4918,6 +5299,7 @@ f() { |
| return p; |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]); |
| verify([source]); |
| @@ -4931,6 +5313,7 @@ f() { |
| p += 1; |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]); |
| verify([source]); |
| @@ -4949,6 +5332,7 @@ f() { |
| p?.g(); |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]); |
| verify([source]); |
| @@ -4956,6 +5340,7 @@ f() { |
| test_privateOptionalParameter() async { |
| Source source = addSource("f({var _p}) {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]); |
| verify([source]); |
| @@ -4967,6 +5352,7 @@ class A { |
| var _p; |
| A({this._p: 0}); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]); |
| verify([source]); |
| @@ -4974,6 +5360,7 @@ class A { |
| test_privateOptionalParameter_withDefaultValue() async { |
| Source source = addSource("f({_p : 0}) {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]); |
| verify([source]); |
| @@ -4985,6 +5372,7 @@ class A { |
| const A(); |
| final m = const A(); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT]); |
| verify([source]); |
| @@ -4994,6 +5382,7 @@ class A { |
| Source source = addSource(r''' |
| const x = y + 1; |
| const y = x + 1;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT, |
| CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT |
| @@ -5009,6 +5398,7 @@ class C { |
| final x; |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT]); |
| verify([source]); |
| @@ -5018,6 +5408,7 @@ class C { |
| Source source = addSource(r''' |
| const x = x; |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT]); |
| verify([source]); |
| @@ -5029,6 +5420,7 @@ class A { |
| A.a() : this.b(); |
| A.b() : this.a(); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.RECURSIVE_CONSTRUCTOR_REDIRECT, |
| CompileTimeErrorCode.RECURSIVE_CONSTRUCTOR_REDIRECT |
| @@ -5041,6 +5433,7 @@ class A { |
| class A { |
| A() : this(); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.RECURSIVE_CONSTRUCTOR_REDIRECT]); |
| verify([source]); |
| @@ -5057,6 +5450,7 @@ class B implements C { |
| class C implements A { |
| factory C() = B; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT, |
| CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT, |
| @@ -5073,6 +5467,7 @@ class C implements A { |
| class A { |
| factory A() = A; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT]); |
| verify([source]); |
| @@ -5090,6 +5485,7 @@ main() { |
| const C<int>(); |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT]); |
| verify([source]); |
| @@ -5106,6 +5502,7 @@ class B<T> implements C<T> { |
| class C<T> implements A<T> { |
| factory C() = B; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT, |
| CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT, |
| @@ -5128,6 +5525,7 @@ class B implements C { |
| class C implements A { |
| factory C.nameC() = B.nameB; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT, |
| CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT, |
| @@ -5154,6 +5552,7 @@ class B implements C { |
| class C implements A, B { |
| factory C() = B; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT, |
| CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT, |
| @@ -5167,6 +5566,7 @@ class C implements A, B { |
| Source source = addSource(r''' |
| class A extends B {} |
| class B extends A {}'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, |
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE |
| @@ -5178,6 +5578,7 @@ class B extends A {}'''); |
| Source source = addSource(r''' |
| class A extends B {} |
| class B implements A {}'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, |
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE |
| @@ -5189,6 +5590,7 @@ class B implements A {}'''); |
| Source source = addSource(r''' |
| class A implements B {} |
| class B implements A {}'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, |
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE |
| @@ -5200,6 +5602,7 @@ class B implements A {}'''); |
| Source source = addSource(r''' |
| class M1 = Object with M2; |
| class M2 = Object with M1;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, |
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE |
| @@ -5215,6 +5618,7 @@ class C = D with M; |
| class D = C with M; |
| class M {} |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, |
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE |
| @@ -5226,6 +5630,7 @@ class M {} |
| Source source = addSource(r''' |
| abstract class A implements A {} |
| class B implements A {}'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS |
| ]); |
| @@ -5237,6 +5642,7 @@ class B implements A {}'''); |
| abstract class A implements B {} |
| abstract class B implements A {} |
| class C implements A {}'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, |
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE |
| @@ -5250,6 +5656,7 @@ abstract class A implements B {} |
| abstract class B implements C {} |
| abstract class C implements A {} |
| class D implements A {}'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, |
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, |
| @@ -5260,6 +5667,7 @@ class D implements A {}'''); |
| test_recursiveInterfaceInheritanceBaseCaseExtends() async { |
| Source source = addSource("class A extends A {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS |
| ]); |
| @@ -5273,6 +5681,7 @@ class C extends C { |
| m(); |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS, |
| StaticWarningCode.CONCRETE_CLASS_WITH_ABSTRACT_MEMBER, |
| @@ -5283,6 +5692,7 @@ class C extends C { |
| test_recursiveInterfaceInheritanceBaseCaseImplements() async { |
| Source source = addSource("class A implements A {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS |
| ]); |
| @@ -5294,6 +5704,7 @@ class C extends C { |
| class A {} |
| class M {} |
| class B = A with M implements B;'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS |
| ]); |
| @@ -5302,6 +5713,7 @@ class B = A with M implements B;'''); |
| test_recursiveInterfaceInheritanceBaseCaseWith() async { |
| Source source = addSource("class M = Object with M;"); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_WITH]); |
| verify([source]); |
| @@ -5312,6 +5724,7 @@ class B = A with M implements B;'''); |
| class A { |
| A() : this.noSuchConstructor(); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.REDIRECT_GENERATIVE_TO_MISSING_CONSTRUCTOR]); |
| } |
| @@ -5322,6 +5735,7 @@ class A { |
| A() : this.x(); |
| factory A.x() => null; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.REDIRECT_GENERATIVE_TO_NON_GENERATIVE_CONSTRUCTOR |
| ]); |
| @@ -5336,6 +5750,7 @@ class A implements B{ |
| class B { |
| const factory B() = A.name; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.REDIRECT_TO_MISSING_CONSTRUCTOR]); |
| } |
| @@ -5348,6 +5763,7 @@ class A implements B{ |
| class B { |
| const factory B() = A; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.REDIRECT_TO_MISSING_CONSTRUCTOR]); |
| } |
| @@ -5358,6 +5774,7 @@ int A; |
| class B { |
| const factory B() = A; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.REDIRECT_TO_NON_CLASS]); |
| verify([source]); |
| } |
| @@ -5367,6 +5784,7 @@ class B { |
| class B { |
| const factory B() = A; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.REDIRECT_TO_NON_CLASS]); |
| verify([source]); |
| } |
| @@ -5377,6 +5795,7 @@ class A { |
| A.a() {} |
| const factory A.b() = A.a; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.REDIRECT_TO_NON_CONST_CONSTRUCTOR]); |
| verify([source]); |
| @@ -5390,6 +5809,7 @@ main() { |
| v() {} |
| } |
| print(x) {}'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]); |
| } |
| @@ -5402,6 +5822,7 @@ main() { |
| var v = 2; |
| } |
| print(x) {}'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]); |
| } |
| @@ -5416,6 +5837,7 @@ main() { |
| var v = 2; |
| } |
| print(x) {}'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]); |
| } |
| @@ -5425,6 +5847,7 @@ print(x) {}'''); |
| main() { |
| var v = () => v; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]); |
| } |
| @@ -5434,6 +5857,7 @@ main() { |
| main() { |
| var v = v; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]); |
| } |
| @@ -5445,6 +5869,7 @@ void testTypeRef() { |
| int String(int x) => x + 1; |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]); |
| } |
| @@ -5456,6 +5881,7 @@ void testTypeRef() { |
| var String = ''; |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]); |
| } |
| @@ -5465,6 +5891,7 @@ void testTypeRef() { |
| f() { |
| rethrow; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.RETHROW_OUTSIDE_CATCH]); |
| verify([source]); |
| } |
| @@ -5474,6 +5901,7 @@ f() { |
| class A { |
| A() { return 0; } |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.RETURN_IN_GENERATIVE_CONSTRUCTOR]); |
| verify([source]); |
| @@ -5484,6 +5912,7 @@ class A { |
| class A { |
| A() => null; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.RETURN_IN_GENERATIVE_CONSTRUCTOR]); |
| verify([source]); |
| @@ -5494,6 +5923,7 @@ class A { |
| f() async* { |
| return 0; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.RETURN_IN_GENERATOR]); |
| verify([source]); |
| } |
| @@ -5503,6 +5933,7 @@ f() async* { |
| f() sync* { |
| return 0; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.RETURN_IN_GENERATOR]); |
| verify([source]); |
| } |
| @@ -5527,6 +5958,7 @@ main() { lib.f1(); lib.f2(); }''' |
| test_superInInvalidContext_binaryExpression() async { |
| Source source = addSource("var v = super + 0;"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); |
| // no verify(), 'super.v' is not resolved |
| @@ -5541,6 +5973,7 @@ class B extends A { |
| var f; |
| B() : f = super.m(); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); |
| // no verify(), 'super.m' is not resolved |
| @@ -5557,6 +5990,7 @@ class B extends A { |
| return null; |
| } |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); |
| // no verify(), 'super.m' is not resolved |
| @@ -5570,6 +6004,7 @@ class A { |
| class B extends A { |
| var b = super.a; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); |
| // no verify(), 'super.a' is not resolved |
| @@ -5583,6 +6018,7 @@ class A { |
| class B extends A { |
| static n() { return super.m(); } |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); |
| // no verify(), 'super.m' is not resolved |
| @@ -5596,6 +6032,7 @@ class A { |
| class B extends A { |
| static int b = super.a; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); |
| // no verify(), 'super.a' is not resolved |
| @@ -5606,6 +6043,7 @@ class B extends A { |
| f() { |
| super.f(); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); |
| // no verify(), 'super.f' is not resolved |
| @@ -5613,6 +6051,7 @@ f() { |
| test_superInInvalidContext_topLevelVariableInitializer() async { |
| Source source = addSource("var v = super.y;"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); |
| // no verify(), 'super.y' is not resolved |
| @@ -5625,6 +6064,7 @@ class B { |
| B() : this.name(), super(); |
| B.name() {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.SUPER_IN_REDIRECTING_CONSTRUCTOR]); |
| verify([source]); |
| @@ -5637,6 +6077,7 @@ class B { |
| B() : super(), this.name(); |
| B.name() {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.SUPER_IN_REDIRECTING_CONSTRUCTOR]); |
| verify([source]); |
| @@ -5649,6 +6090,7 @@ var s2 = const Symbol(3); |
| var s3 = const Symbol(); |
| var s4 = const Symbol('x', 'y'); |
| var s5 = const Symbol('x', foo: 'x');'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION, |
| CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION, |
| @@ -5667,6 +6109,7 @@ typedef void G(List<F> l); |
| main() { |
| F foo(G g) => g; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, |
| CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF |
| @@ -5685,12 +6128,14 @@ abstract class D { |
| abstract class E extends A<dynamic, F> {} |
| typedef D F(); |
| '''); |
| + await computeAnalysisResult(source); |
| await assertNoErrors(source); |
| verify([source]); |
| } |
| test_typeAliasCannotReferenceItself_parameterType_named() async { |
| Source source = addSource("typedef A({A a});"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]); |
| verify([source]); |
| @@ -5698,6 +6143,7 @@ typedef D F(); |
| test_typeAliasCannotReferenceItself_parameterType_positional() async { |
| Source source = addSource("typedef A([A a]);"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]); |
| verify([source]); |
| @@ -5705,6 +6151,7 @@ typedef D F(); |
| test_typeAliasCannotReferenceItself_parameterType_required() async { |
| Source source = addSource("typedef A(A a);"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]); |
| verify([source]); |
| @@ -5712,6 +6159,7 @@ typedef D F(); |
| test_typeAliasCannotReferenceItself_parameterType_typeArgument() async { |
| Source source = addSource("typedef A(List<A> a);"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]); |
| verify([source]); |
| @@ -5725,12 +6173,14 @@ typedef A B(); |
| class C { |
| B a; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertNoErrors(source); |
| verify([source]); |
| } |
| test_typeAliasCannotReferenceItself_returnType() async { |
| Source source = addSource("typedef A A();"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]); |
| verify([source]); |
| @@ -5740,6 +6190,7 @@ class C { |
| Source source = addSource(r''' |
| typedef B A(); |
| typedef A B();'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, |
| CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF |
| @@ -5749,6 +6200,7 @@ typedef A B();'''); |
| test_typeAliasCannotReferenceItself_typeVariableBounds() async { |
| Source source = addSource("typedef A<T extends A>();"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]); |
| verify([source]); |
| @@ -5762,6 +6214,7 @@ class G<E extends A> { |
| const G(); |
| } |
| f() { return const G<B>(); }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); |
| verify([source]); |
| @@ -5772,6 +6225,7 @@ f() { return const G<B>(); }'''); |
| f() { |
| return const A(); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.UNDEFINED_CLASS]); |
| verify([source]); |
| } |
| @@ -5782,6 +6236,7 @@ class A {} |
| class B extends A { |
| B() : super.named(); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER]); |
| // no verify(), "super.named()" is not resolved |
| @@ -5795,6 +6250,7 @@ class A { |
| class B extends A { |
| B() : super(); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT]); |
| verify([source]); |
| @@ -5808,6 +6264,7 @@ class A { |
| class B extends A { |
| B(); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT]); |
| verify([source]); |
| @@ -5821,6 +6278,7 @@ class A { |
| main() { |
| const A(p: 0); |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.UNDEFINED_NAMED_PARAMETER]); |
| // no verify(), 'p' is not resolved |
| @@ -5828,17 +6286,20 @@ main() { |
| test_uriDoesNotExist_export() async { |
| Source source = addSource("export 'unknown.dart';"); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]); |
| } |
| test_uriDoesNotExist_import() async { |
| Source source = addSource("import 'unknown.dart';"); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]); |
| } |
| test_uriDoesNotExist_import_appears_after_deleting_target() async { |
| Source test = addSource("import 'target.dart';"); |
| Source target = addNamedSource("/target.dart", ""); |
| + await computeAnalysisResult(test); |
| await assertErrors(test, [HintCode.UNUSED_IMPORT]); |
| // Remove the overlay in the same way as AnalysisServer. |
| @@ -5846,11 +6307,13 @@ main() { |
| ChangeSet changeSet = new ChangeSet()..removedSource(target); |
| analysisContext2.applyChanges(changeSet); |
| + await computeAnalysisResult(test); |
| await assertErrors(test, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]); |
| } |
| test_uriDoesNotExist_import_disappears_when_fixed() async { |
| Source source = addSource("import 'target.dart';"); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]); |
| // Check that the file is represented as missing. |
| @@ -5865,6 +6328,7 @@ main() { |
| ..handleContentsChanged(target, null, "", true); |
| // Make sure the error goes away. |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [HintCode.UNUSED_IMPORT]); |
| } |
| @@ -5872,11 +6336,13 @@ main() { |
| Source source = addSource(r''' |
| library lib; |
| part 'unknown.dart';'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]); |
| } |
| test_uriWithInterpolation_constant() async { |
| Source source = addSource("import 'stuff_\$platform.dart';"); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.URI_WITH_INTERPOLATION, |
| StaticWarningCode.UNDEFINED_IDENTIFIER |
| @@ -5889,6 +6355,7 @@ part 'unknown.dart';'''); |
| Source source = addSource(r''' |
| library lib; |
| part '${'a'}.dart';'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [CompileTimeErrorCode.URI_WITH_INTERPOLATION]); |
| // We cannot verify resolution with an unresolvable URI: '${'a'}.dart' |
| } |
| @@ -5916,6 +6383,7 @@ part '${'a'}.dart';'''); |
| class A { |
| operator -(a, b) {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, |
| [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINUS]); |
| verify([source]); |
| @@ -5929,6 +6397,7 @@ class A { |
| test_wrongNumberOfParametersForSetter_function_named() async { |
| Source source = addSource("set x({p}) {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]); |
| verify([source]); |
| @@ -5936,6 +6405,7 @@ class A { |
| test_wrongNumberOfParametersForSetter_function_optional() async { |
| Source source = addSource("set x([p]) {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]); |
| verify([source]); |
| @@ -5943,6 +6413,7 @@ class A { |
| test_wrongNumberOfParametersForSetter_function_tooFew() async { |
| Source source = addSource("set x() {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]); |
| verify([source]); |
| @@ -5950,6 +6421,7 @@ class A { |
| test_wrongNumberOfParametersForSetter_function_tooMany() async { |
| Source source = addSource("set x(a, b) {}"); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]); |
| verify([source]); |
| @@ -5960,6 +6432,7 @@ class A { |
| class A { |
| set x({p}) {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]); |
| verify([source]); |
| @@ -5970,6 +6443,7 @@ class A { |
| class A { |
| set x([p]) {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]); |
| verify([source]); |
| @@ -5980,6 +6454,7 @@ class A { |
| class A { |
| set x() {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]); |
| verify([source]); |
| @@ -5990,6 +6465,7 @@ class A { |
| class A { |
| set x(a, b) {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]); |
| verify([source]); |
| @@ -6001,6 +6477,7 @@ f() async { |
| var yield = 1; |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]); |
| verify([source]); |
| @@ -6012,6 +6489,7 @@ f() async* { |
| var yield = 1; |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]); |
| verify([source]); |
| @@ -6023,6 +6501,7 @@ f() sync* { |
| var yield = 1; |
| } |
| '''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]); |
| verify([source]); |
| @@ -6032,10 +6511,12 @@ f() sync* { |
| String expr, bool resolved) async { |
| Source source = addSource("const C = $expr;"); |
| if (resolved) { |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]); |
| verify([source]); |
| } else { |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]); |
| // no verify(), 'null x' is not resolved |
| @@ -6050,6 +6531,7 @@ class A { |
| final a; |
| const A(bool p) : a = $expr; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL, |
| StaticTypeWarningCode.NON_BOOL_OPERAND |
| @@ -6064,6 +6546,7 @@ class A { |
| final a; |
| const A(int p) : a = $expr; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.CONST_EVAL_TYPE_INT, |
| StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE |
| @@ -6078,6 +6561,7 @@ class A { |
| final a; |
| const A(num p) : a = $expr; |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors(source, [ |
| CompileTimeErrorCode.CONST_EVAL_TYPE_NUM, |
| StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE |
| @@ -6092,6 +6576,7 @@ class A { |
| class A { |
| operator $name($parameters) {} |
| }'''); |
| + await computeAnalysisResult(source); |
| await assertErrors( |
| source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]); |
| verify([source]); |