| 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..9cb6c245599d167f07490d653d9c6e1907eab21f 100644
|
| --- a/pkg/analyzer/test/generated/compile_time_error_code_test.dart
|
| +++ b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
|
| @@ -32,7 +32,8 @@ class CompileTimeErrorCodeTest extends ResolverTestCase {
|
| f(x) {
|
| return await x;
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT]);
|
| verify([source]);
|
| }
|
|
|
| @@ -44,7 +45,8 @@ f(x) {
|
| f(x) sync* {
|
| yield await x;
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT]);
|
| verify([source]);
|
| }
|
|
|
| @@ -54,7 +56,8 @@ class C {
|
| const C();
|
| }
|
| f() { return const C(); }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.CONST_CONSTRUCTOR_THROWS_EXCEPTION]);
|
| verify([source]);
|
| }
|
| @@ -67,8 +70,8 @@ class A {
|
| int async;
|
| }
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.INVALID_IDENTIFIER_IN_ASYNC]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INVALID_IDENTIFIER_IN_ASYNC]);
|
| verify([source]);
|
| }
|
|
|
| @@ -80,8 +83,8 @@ class A {
|
| int await;
|
| }
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.INVALID_IDENTIFIER_IN_ASYNC]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INVALID_IDENTIFIER_IN_ASYNC]);
|
| verify([source]);
|
| }
|
|
|
| @@ -93,8 +96,8 @@ class A {
|
| int yield;
|
| }
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.INVALID_IDENTIFIER_IN_ASYNC]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INVALID_IDENTIFIER_IN_ASYNC]);
|
| verify([source]);
|
| }
|
|
|
| @@ -104,8 +107,8 @@ class A {
|
| A() {}
|
| }
|
| class B extends Object mixin A {}''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
|
|
| @@ -114,14 +117,16 @@ class B extends Object mixin A {}''');
|
| Source source = addSource(r'''
|
| var A;
|
| class B extends Object mixin A {}''');
|
| - await assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_NON_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_NON_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| fail_objectCannotExtendAnotherClass() async {
|
| Source source = addSource(r'''
|
| ''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.OBJECT_CANNOT_EXTEND_ANOTHER_CLASS]);
|
| verify([source]);
|
| }
|
| @@ -129,8 +134,8 @@ class B extends Object mixin A {}''');
|
| fail_superInitializerInObject() async {
|
| Source source = addSource(r'''
|
| ''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.SUPER_INITIALIZER_IN_OBJECT]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.SUPER_INITIALIZER_IN_OBJECT]);
|
| verify([source]);
|
| }
|
|
|
| @@ -141,8 +146,8 @@ class B extends Object mixin A {}''');
|
| f() async {
|
| yield* 0;
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.YIELD_EACH_IN_NON_GENERATOR]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.YIELD_EACH_IN_NON_GENERATOR]);
|
| verify([source]);
|
| }
|
|
|
| @@ -153,7 +158,8 @@ f() async {
|
| f() {
|
| yield* 0;
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.YIELD_IN_NON_GENERATOR]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.YIELD_IN_NON_GENERATOR]);
|
| verify([source]);
|
| }
|
|
|
| @@ -164,7 +170,8 @@ f() {
|
| f() async {
|
| yield 0;
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.YIELD_IN_NON_GENERATOR]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.YIELD_IN_NON_GENERATOR]);
|
| verify([source]);
|
| }
|
|
|
| @@ -175,8 +182,8 @@ f() async {
|
| f() {
|
| yield 0;
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.YIELD_EACH_IN_NON_GENERATOR]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.YIELD_EACH_IN_NON_GENERATOR]);
|
| verify([source]);
|
| }
|
|
|
| @@ -186,8 +193,8 @@ enum E { ONE }
|
| String name(E e) {
|
| return e._name;
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.ACCESS_PRIVATE_ENUM_FIELD]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.ACCESS_PRIVATE_ENUM_FIELD]);
|
| // Cannot verify because "_name" cannot be resolved.
|
| }
|
|
|
| @@ -206,7 +213,8 @@ class N {}''');
|
| r'''
|
| library lib2;
|
| class N {}''');
|
| - await assertErrors(source, [CompileTimeErrorCode.AMBIGUOUS_EXPORT]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.AMBIGUOUS_EXPORT]);
|
| verify([source]);
|
| }
|
|
|
| @@ -223,8 +231,8 @@ const Property property = const Property(42);
|
| main() {
|
| }
|
| ''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.ANNOTATION_WITH_NON_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.ANNOTATION_WITH_NON_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -245,8 +253,8 @@ import 'annotations.dart' as pref;
|
| main() {
|
| }
|
| ''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.ANNOTATION_WITH_NON_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.ANNOTATION_WITH_NON_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -258,8 +266,8 @@ f() async {
|
| g(0);
|
| }
|
| ''');
|
| - await assertErrors(
|
| - source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| @@ -271,8 +279,8 @@ f() async {
|
| new C().g(async: 0);
|
| }
|
| ''');
|
| - await assertErrors(
|
| - source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| // Note: we don't call verify([source]) because verify() doesn't understand
|
| // about @proxy.
|
| }
|
| @@ -283,8 +291,8 @@ f() async {
|
| var async = 1;
|
| }
|
| ''');
|
| - await assertErrors(
|
| - source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| @@ -294,8 +302,8 @@ f() async* {
|
| var async = 1;
|
| }
|
| ''');
|
| - await assertErrors(
|
| - source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| @@ -307,7 +315,8 @@ f() async {
|
| }
|
| }
|
| ''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER,
|
| CompileTimeErrorCode.LABEL_UNDEFINED
|
| ]);
|
| @@ -324,8 +333,8 @@ f() async {
|
| return new C()..async();
|
| }
|
| ''');
|
| - await assertErrors(
|
| - source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| @@ -338,8 +347,8 @@ f() async {
|
| return new C()..async = 1;
|
| }
|
| ''');
|
| - await assertErrors(
|
| - source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| @@ -352,8 +361,8 @@ f() async {
|
| } catch (async) { }
|
| }
|
| ''');
|
| - await assertErrors(
|
| - source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| @@ -366,8 +375,8 @@ f() async {
|
| } catch (e, async) { }
|
| }
|
| ''');
|
| - await assertErrors(
|
| - source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| @@ -379,7 +388,8 @@ f() async {
|
| }
|
| }
|
| ''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER,
|
| CompileTimeErrorCode.LABEL_UNDEFINED
|
| ]);
|
| @@ -394,8 +404,8 @@ f() async {
|
| for (async in []) {}
|
| }
|
| ''');
|
| - await assertErrors(
|
| - source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| @@ -406,8 +416,8 @@ f() async {
|
| g(0);
|
| }
|
| ''');
|
| - await assertErrors(
|
| - source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| @@ -420,8 +430,8 @@ f() async {
|
| return new C().async;
|
| }
|
| ''');
|
| - await assertErrors(
|
| - source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| @@ -434,8 +444,8 @@ f() async {
|
| return new C().async();
|
| }
|
| ''');
|
| - await assertErrors(
|
| - source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| @@ -445,8 +455,8 @@ f() async {
|
| int async() => null;
|
| }
|
| ''');
|
| - await assertErrors(
|
| - source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| @@ -457,8 +467,8 @@ f() async {
|
| return new async.Future.value(0);
|
| }
|
| ''');
|
| - await assertErrors(
|
| - source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| @@ -471,8 +481,8 @@ f() async {
|
| new C().async = 1;
|
| }
|
| ''');
|
| - await assertErrors(
|
| - source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| @@ -483,8 +493,8 @@ f() async {
|
| }
|
| g() {}
|
| ''');
|
| - await assertErrors(
|
| - source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| @@ -495,8 +505,8 @@ f() async {
|
| return "$async";
|
| }
|
| ''');
|
| - await assertErrors(
|
| - source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| @@ -513,8 +523,8 @@ f() async {
|
| return l.async;
|
| }
|
| ''');
|
| - await assertErrors(
|
| - source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| @@ -526,8 +536,8 @@ f() async {
|
| }
|
| }
|
| ''');
|
| - await assertErrors(
|
| - source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| @@ -537,8 +547,8 @@ f() sync* {
|
| var async = 1;
|
| }
|
| ''');
|
| - await assertErrors(
|
| - source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| @@ -548,8 +558,8 @@ f(list) {
|
| await for (var e in list) {
|
| }
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.ASYNC_FOR_IN_WRONG_CONTEXT]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.ASYNC_FOR_IN_WRONG_CONTEXT]);
|
| verify([source]);
|
| }
|
|
|
| @@ -559,8 +569,8 @@ f() async {
|
| var await = 1;
|
| }
|
| ''');
|
| - await assertErrors(
|
| - source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| @@ -570,8 +580,8 @@ f() async* {
|
| var await = 1;
|
| }
|
| ''');
|
| - await assertErrors(
|
| - source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| @@ -581,8 +591,8 @@ f() sync* {
|
| var await = 1;
|
| }
|
| ''');
|
| - await assertErrors(
|
| - source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| @@ -595,7 +605,8 @@ class B {
|
| dynamic @A(const A()) x;
|
| }
|
| ''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| ParserErrorCode.EXPECTED_CLASS_MEMBER,
|
| ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE
|
| ]);
|
| @@ -607,7 +618,8 @@ class B {
|
| class A {}
|
| class B {}
|
| class as = A with B;''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME]);
|
| verify([source]);
|
| }
|
| @@ -618,8 +630,8 @@ class A {
|
| var x;
|
| A(static this.x);
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE]);
|
| verify([source]);
|
| }
|
|
|
| @@ -627,8 +639,8 @@ class A {
|
| Source source = addSource(r'''
|
| f(static x) {
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE]);
|
| verify([source]);
|
| }
|
|
|
| @@ -637,28 +649,31 @@ f(static x) {
|
| f() {
|
| typedef x;
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE]);
|
| verify([source]);
|
| }
|
|
|
| test_builtInIdentifierAsTypedefName_functionTypeAlias() async {
|
| Source source = addSource("typedef bool as();");
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME]);
|
| verify([source]);
|
| }
|
|
|
| test_builtInIdentifierAsTypeName() async {
|
| Source source = addSource("class as {}");
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME]);
|
| verify([source]);
|
| }
|
|
|
| test_builtInIdentifierAsTypeParameterName() async {
|
| Source source = addSource("class A<as> {}");
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME]);
|
| verify([source]);
|
| }
|
| @@ -680,7 +695,8 @@ f(var a) {
|
| default: return 0;
|
| }
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS]);
|
| verify([source]);
|
| }
|
| @@ -691,7 +707,8 @@ class A {
|
| int x;
|
| A.x() {}
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD]);
|
| verify([source]);
|
| }
|
| @@ -702,7 +719,8 @@ class A {
|
| const A.x();
|
| void x() {}
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD]);
|
| verify([source]);
|
| }
|
| @@ -715,8 +733,8 @@ class A {
|
| class B extends A {
|
| m() {}
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD]);
|
| verify([source]);
|
| }
|
|
|
| @@ -728,8 +746,8 @@ class A {
|
| class B extends A {
|
| m() {}
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD]);
|
| verify([source]);
|
| }
|
|
|
| @@ -741,8 +759,8 @@ class A {
|
| class B extends A {
|
| int m;
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER]);
|
| verify([source]);
|
| }
|
|
|
| @@ -754,8 +772,8 @@ class A {
|
| class B extends A {
|
| get m => 0;
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER]);
|
| verify([source]);
|
| }
|
|
|
| @@ -763,7 +781,8 @@ class B extends A {
|
| Source source = addSource(r'''
|
| class T<T> {
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_CLASS]);
|
| verify([source]);
|
| }
|
| @@ -773,7 +792,8 @@ class T<T> {
|
| class A<T> {
|
| var T;
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER]);
|
| verify([source]);
|
| }
|
| @@ -783,7 +803,8 @@ class A<T> {
|
| class A<T> {
|
| get T => null;
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER]);
|
| verify([source]);
|
| }
|
| @@ -793,7 +814,8 @@ class A<T> {
|
| class A<T> {
|
| T() {}
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER]);
|
| verify([source]);
|
| }
|
| @@ -803,7 +825,8 @@ class A<T> {
|
| class A<T> {
|
| static T() {}
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER]);
|
| verify([source]);
|
| }
|
| @@ -813,7 +836,8 @@ class A<T> {
|
| class A<T> {
|
| set T(x) {}
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER]);
|
| verify([source]);
|
| }
|
| @@ -838,7 +862,8 @@ foo(var p) {
|
| break;
|
| }
|
| }''');
|
| - await assertNoErrors(source);
|
| + await computeAnalysisResult(source);
|
| + assertNoErrors(source);
|
| verify([source]);
|
| }
|
|
|
| @@ -853,7 +878,8 @@ int f() {
|
| }''');
|
| // TODO(paulberry): the error CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE is
|
| // redundant and ought to be suppressed.
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode
|
| .CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST,
|
| CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
|
| @@ -870,7 +896,8 @@ class A {
|
| int f() {
|
| return 3;
|
| }''');
|
| - await assertNoErrors(source);
|
| + await computeAnalysisResult(source);
|
| + assertNoErrors(source);
|
| verify([source]);
|
| }
|
|
|
| @@ -881,8 +908,8 @@ class M {
|
| class A extends Object with M {
|
| const A();
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_MIXIN]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_MIXIN]);
|
| verify([source]);
|
| }
|
|
|
| @@ -894,7 +921,8 @@ class A {
|
| class B extends A {
|
| const B(): super();
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER]);
|
| verify([source]);
|
| }
|
| @@ -907,7 +935,8 @@ class A {
|
| class B extends A {
|
| const B();
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER]);
|
| verify([source]);
|
| }
|
| @@ -920,7 +949,8 @@ class A {
|
| class B extends Object with A {
|
| const B();
|
| }''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_MIXIN,
|
| CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD
|
| ]);
|
| @@ -935,7 +965,8 @@ class A {
|
| class B extends A {
|
| const B();
|
| }''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD,
|
| CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER
|
| ]);
|
| @@ -948,7 +979,8 @@ class A {
|
| int x;
|
| const A();
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD]);
|
| verify([source]);
|
| }
|
| @@ -995,7 +1027,8 @@ class A {
|
| const A();
|
| }
|
| const a = new A();''');
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
|
| verify([source]);
|
| }
|
| @@ -1008,7 +1041,8 @@ class A {
|
| external factory const A();
|
| }
|
| const x = const A();''');
|
| - await assertNoErrors(source);
|
| + await computeAnalysisResult(source);
|
| + assertNoErrors(source);
|
| verify([source]);
|
| }
|
|
|
| @@ -1020,7 +1054,8 @@ class C<T> {
|
| }
|
|
|
| const x = const C().t;''');
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
|
| verify([source]);
|
| }
|
| @@ -1033,7 +1068,8 @@ class A {
|
| }
|
| final a = const A();
|
| const C = a.m;''');
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
|
| verify([source]);
|
| }
|
| @@ -1050,7 +1086,8 @@ const C = a.m;''');
|
|
|
| test_constEvalThrowsException_divisionByZero() async {
|
| Source source = addSource("const C = 1 ~/ 0;");
|
| - await assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_THROWS_IDBZE]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_THROWS_IDBZE]);
|
| verify([source]);
|
| }
|
|
|
| @@ -1066,7 +1103,8 @@ class C {
|
| }
|
| var x = const C();
|
| ''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION,
|
| StaticWarningCode.FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION
|
| ]);
|
| @@ -1086,7 +1124,8 @@ class C {
|
| }
|
| var x = const C(2);
|
| ''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION,
|
| StaticWarningCode.FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR
|
| ]);
|
| @@ -1095,22 +1134,22 @@ var x = const C(2);
|
|
|
| test_constEvalThrowsException_unaryBitNot_null() async {
|
| Source source = addSource("const C = ~null;");
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]);
|
| // no verify(), '~null' is not resolved
|
| }
|
|
|
| test_constEvalThrowsException_unaryNegated_null() async {
|
| Source source = addSource("const C = -null;");
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]);
|
| // no verify(), '-null' is not resolved
|
| }
|
|
|
| test_constEvalThrowsException_unaryNot_null() async {
|
| Source source = addSource("const C = !null;");
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]);
|
| verify([source]);
|
| }
|
|
|
| @@ -1121,7 +1160,8 @@ var x = const C(2);
|
|
|
| test_constEvalTypeBool_binary_leftTrue() async {
|
| Source source = addSource("const C = (true || 0);");
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL,
|
| StaticTypeWarningCode.NON_BOOL_OPERAND,
|
| HintCode.DEAD_CODE
|
| @@ -1138,7 +1178,8 @@ class B {
|
| final a;
|
| const B(num p) : a = p == const A();
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL_NUM_STRING]);
|
| verify([source]);
|
| }
|
| @@ -1152,7 +1193,8 @@ class B {
|
| final a;
|
| const B(String p) : a = p != const A();
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL_NUM_STRING]);
|
| verify([source]);
|
| }
|
| @@ -1184,13 +1226,15 @@ class A {
|
| var x;
|
| A(const this.x) {}
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.CONST_FORMAL_PARAMETER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.CONST_FORMAL_PARAMETER]);
|
| verify([source]);
|
| }
|
|
|
| test_constFormalParameter_simpleFormalParameter() async {
|
| Source source = addSource("f(const x) {}");
|
| - await assertErrors(source, [CompileTimeErrorCode.CONST_FORMAL_PARAMETER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.CONST_FORMAL_PARAMETER]);
|
| verify([source]);
|
| }
|
|
|
| @@ -1199,7 +1243,8 @@ class A {
|
| f(p) {
|
| const C = p;
|
| }''');
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
|
| verify([source]);
|
| }
|
| @@ -1213,21 +1258,23 @@ class Foo {
|
| foo([int x = field]) {}
|
| }
|
| ''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
|
| verify([source]);
|
| }
|
|
|
| test_constInitializedWithNonConstValue_missingConstInListLiteral() async {
|
| Source source = addSource("const List L = [0];");
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
|
| verify([source]);
|
| }
|
|
|
| test_constInitializedWithNonConstValue_missingConstInMapLiteral() async {
|
| Source source = addSource("const Map M = {'a' : 0};");
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
|
| verify([source]);
|
| }
|
| @@ -1267,7 +1314,8 @@ const B = a.V + 1;'''
|
| class C {
|
| const int f = 0;
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.CONST_INSTANCE_FIELD]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.CONST_INSTANCE_FIELD]);
|
| verify([source]);
|
| }
|
|
|
| @@ -1280,7 +1328,8 @@ class A {
|
| main() {
|
| const {const A() : 0};
|
| }''');
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS]);
|
| verify([source]);
|
| }
|
| @@ -1300,7 +1349,8 @@ class B {
|
| main() {
|
| const {B.a : 0};
|
| }''');
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS]);
|
| verify([source]);
|
| }
|
| @@ -1318,7 +1368,8 @@ class B implements A {
|
| main() {
|
| var m = const { const A(): 42 };
|
| }''');
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS]);
|
| verify([source]);
|
| }
|
| @@ -1335,7 +1386,8 @@ class B extends A {
|
| main() {
|
| const {const B() : 0};
|
| }''');
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS]);
|
| verify([source]);
|
| }
|
| @@ -1346,7 +1398,8 @@ class A {
|
| const A();
|
| }
|
| f() { return const A<A>(); }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS]);
|
| verify([source]);
|
| }
|
| @@ -1360,7 +1413,8 @@ class C<K, V> {
|
| f(p) {
|
| return const C<A>();
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS]);
|
| verify([source]);
|
| }
|
| @@ -1374,7 +1428,8 @@ class C<E> {
|
| f(p) {
|
| return const C<A, A>();
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS]);
|
| verify([source]);
|
| }
|
| @@ -1385,7 +1440,8 @@ class T {
|
| T(a, b, {c, d}) {}
|
| }
|
| f() { return const T(0, 1, c: 2, d: 3); }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.CONST_WITH_NON_CONST]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.CONST_WITH_NON_CONST]);
|
| verify([source]);
|
| }
|
|
|
| @@ -1401,7 +1457,8 @@ main() {
|
| print(x);
|
| }
|
| ''');
|
| - await assertErrors(source, [CompileTimeErrorCode.CONST_WITH_NON_CONST]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.CONST_WITH_NON_CONST]);
|
| verify([source]);
|
| }
|
|
|
| @@ -1414,7 +1471,8 @@ var v = 42;
|
| @A(v)
|
| main() {
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.CONST_WITH_NON_CONSTANT_ARGUMENT]);
|
| verify([source]);
|
| }
|
| @@ -1427,7 +1485,8 @@ class A {
|
| f(p) { return const A(p); }''');
|
| // TODO(paulberry): the error INVALID_CONSTAT is redundant and ought to be
|
| // suppressed.
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.CONST_WITH_NON_CONSTANT_ARGUMENT,
|
| CompileTimeErrorCode.INVALID_CONSTANT
|
| ]);
|
| @@ -1440,7 +1499,8 @@ int A;
|
| f() {
|
| return const A();
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.CONST_WITH_NON_TYPE]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.CONST_WITH_NON_TYPE]);
|
| verify([source]);
|
| }
|
|
|
| @@ -1453,8 +1513,9 @@ import 'lib.dart' as lib;
|
| void f() {
|
| const lib.A();
|
| }''');
|
| - await assertErrors(source2, [CompileTimeErrorCode.CONST_WITH_NON_TYPE]);
|
| - verify([source1]);
|
| + await computeAnalysisResult(source1);
|
| + await computeAnalysisResult(source2);
|
| + assertErrors(source2, [CompileTimeErrorCode.CONST_WITH_NON_TYPE]);
|
| }
|
|
|
| test_constWithTypeParameters_direct() async {
|
| @@ -1463,7 +1524,8 @@ class A<T> {
|
| static const V = const A<T>();
|
| const A();
|
| }''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS,
|
| StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC
|
| ]);
|
| @@ -1476,7 +1538,8 @@ class A<T> {
|
| static const V = const A<List<T>>();
|
| const A();
|
| }''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS,
|
| StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC
|
| ]);
|
| @@ -1491,7 +1554,8 @@ class A {
|
| f() {
|
| return const A.noSuchConstructor();
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR]);
|
| // no verify(), 'noSuchConstructor' is not resolved
|
| }
|
| @@ -1504,28 +1568,32 @@ class A {
|
| f() {
|
| return const A();
|
| }''');
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT]);
|
| verify([source]);
|
| }
|
|
|
| test_defaultValueInFunctionTypeAlias() async {
|
| Source source = addSource("typedef F([x = 0]);");
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS]);
|
| verify([source]);
|
| }
|
|
|
| test_defaultValueInFunctionTypedParameter_named() async {
|
| Source source = addSource("f(g({p: null})) {}");
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER]);
|
| verify([source]);
|
| }
|
|
|
| test_defaultValueInFunctionTypedParameter_optional() async {
|
| Source source = addSource("f(g([p = null])) {}");
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER]);
|
| verify([source]);
|
| }
|
| @@ -1539,7 +1607,8 @@ class A {
|
| class B implements A {
|
| B([int x = 1]) {}
|
| }''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR
|
| ]);
|
| verify([source]);
|
| @@ -1551,7 +1620,8 @@ class A {
|
| A.a() {}
|
| A.a() {}
|
| }''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_NAME,
|
| CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_NAME
|
| ]);
|
| @@ -1564,7 +1634,8 @@ class A {
|
| A() {}
|
| A() {}
|
| }''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_DEFAULT,
|
| CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_DEFAULT
|
| ]);
|
| @@ -1591,8 +1662,11 @@ class A {}''');
|
| part of lib;
|
|
|
| class A {}''');
|
| - await assertNoErrors(librarySource);
|
| - await assertErrors(sourceB, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| + await computeAnalysisResult(librarySource);
|
| + await computeAnalysisResult(sourceA);
|
| + await computeAnalysisResult(sourceB);
|
| + assertNoErrors(librarySource);
|
| + assertErrors(sourceB, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| verify([librarySource, sourceA, sourceB]);
|
| }
|
|
|
| @@ -1601,7 +1675,8 @@ class A {}''');
|
| main() {
|
| try {} catch (e, e) {}
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| verify([source]);
|
| }
|
|
|
| @@ -1611,7 +1686,8 @@ class A {
|
| int a;
|
| int a;
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| verify([source]);
|
| }
|
|
|
| @@ -1621,7 +1697,8 @@ class A {
|
| int x;
|
| static int x;
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| verify([source]);
|
| }
|
|
|
| @@ -1631,7 +1708,8 @@ class A {
|
| m() {}
|
| m() {}
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| verify([source]);
|
| }
|
|
|
| @@ -1647,8 +1725,10 @@ class A {}''');
|
| r'''
|
| part of test;
|
| class A {}''');
|
| - await assertNoErrors(librarySource);
|
| - await assertErrors(sourceA, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| + await computeAnalysisResult(librarySource);
|
| + await computeAnalysisResult(sourceA);
|
| + assertNoErrors(librarySource);
|
| + assertErrors(sourceA, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| verify([librarySource, sourceA]);
|
| }
|
|
|
| @@ -1661,7 +1741,8 @@ main() {
|
| var a;
|
| }
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| verify([source]);
|
| }
|
|
|
| @@ -1671,7 +1752,8 @@ main() {
|
| int m = 0;
|
| m(a) {}
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| verify([source]);
|
| }
|
|
|
| @@ -1683,7 +1765,8 @@ main(int p) {
|
| var a;
|
| }
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| verify([source]);
|
| }
|
|
|
| @@ -1695,7 +1778,8 @@ class A {
|
| int a;
|
| }
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| verify([source]);
|
| }
|
|
|
| @@ -1705,7 +1789,8 @@ class A {
|
| int a;
|
| A(int a, this.a);
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| verify([source]);
|
| }
|
|
|
| @@ -1713,7 +1798,8 @@ class A {
|
| Source source = addSource(r'''
|
| typedef F(int a, double a);
|
| ''');
|
| - await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| verify([source]);
|
| }
|
|
|
| @@ -1723,7 +1809,8 @@ main() {
|
| f(int a, double a) {
|
| };
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| verify([source]);
|
| }
|
|
|
| @@ -1733,7 +1820,8 @@ class A {
|
| m(int a, double a) {
|
| }
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| verify([source]);
|
| }
|
|
|
| @@ -1741,7 +1829,8 @@ class A {
|
| Source source = addSource(r'''
|
| f(int a, double a) {
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| verify([source]);
|
| }
|
|
|
| @@ -1749,7 +1838,8 @@ f(int a, double a) {
|
| Source source = addSource(r'''
|
| class A<T, T> {
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
|
| verify([source]);
|
| }
|
|
|
| @@ -1761,7 +1851,8 @@ class A {
|
| class B extends A {
|
| static int get x => 0;
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]);
|
| verify([source]);
|
| }
|
| @@ -1774,7 +1865,8 @@ abstract class A {
|
| class B extends A {
|
| static int get x => 0;
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]);
|
| verify([source]);
|
| }
|
| @@ -1787,7 +1879,8 @@ class A {
|
| class B extends A {
|
| static x() {}
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]);
|
| verify([source]);
|
| }
|
| @@ -1800,7 +1893,8 @@ abstract class A {
|
| abstract class B extends A {
|
| static x() {}
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]);
|
| verify([source]);
|
| }
|
| @@ -1813,7 +1907,8 @@ class A {
|
| class B extends A {
|
| static set x(value) {}
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]);
|
| verify([source]);
|
| }
|
| @@ -1826,7 +1921,8 @@ abstract class A {
|
| class B extends A {
|
| static set x(value) {}
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]);
|
| verify([source]);
|
| }
|
| @@ -1837,8 +1933,8 @@ f({a, b}) {}
|
| main() {
|
| f(a: 1, a: 2);
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.DUPLICATE_NAMED_ARGUMENT]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.DUPLICATE_NAMED_ARGUMENT]);
|
| verify([source]);
|
| }
|
|
|
| @@ -1849,7 +1945,8 @@ library lib;
|
| part 'part.dart';
|
| part 'foo/../part.dart';
|
| ''');
|
| - await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_PART]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.DUPLICATE_PART]);
|
| verify([source]);
|
| }
|
|
|
| @@ -1860,13 +1957,15 @@ library lib;
|
| part 'part.dart';
|
| part 'part.dart';
|
| ''');
|
| - await assertErrors(source, [CompileTimeErrorCode.DUPLICATE_PART]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.DUPLICATE_PART]);
|
| verify([source]);
|
| }
|
|
|
| test_exportInternalLibrary() async {
|
| Source source = addSource("export 'dart:_interceptors';");
|
| - await assertErrors(source, [CompileTimeErrorCode.EXPORT_INTERNAL_LIBRARY]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.EXPORT_INTERNAL_LIBRARY]);
|
| verify([source]);
|
| }
|
|
|
| @@ -1875,7 +1974,8 @@ part 'part.dart';
|
| library L;
|
| export 'lib1.dart';''');
|
| addNamedSource("/lib1.dart", "part of lib;");
|
| - await assertErrors(source, [CompileTimeErrorCode.EXPORT_OF_NON_LIBRARY]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.EXPORT_OF_NON_LIBRARY]);
|
| verify([source]);
|
| }
|
|
|
| @@ -1910,7 +2010,8 @@ class C = a.A with M;'''
|
|
|
| test_extendsDisallowedClass_class_bool() async {
|
| Source source = addSource("class A extends bool {}");
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS,
|
| CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT
|
| ]);
|
| @@ -1919,14 +2020,15 @@ class C = a.A with M;'''
|
|
|
| test_extendsDisallowedClass_class_double() async {
|
| Source source = addSource("class A extends double {}");
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| test_extendsDisallowedClass_class_int() async {
|
| Source source = addSource("class A extends int {}");
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS,
|
| CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT
|
| ]);
|
| @@ -1935,7 +2037,8 @@ class C = a.A with M;'''
|
|
|
| test_extendsDisallowedClass_class_Null() async {
|
| Source source = addSource("class A extends Null {}");
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS,
|
| CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT
|
| ]);
|
| @@ -1944,14 +2047,15 @@ class C = a.A with M;'''
|
|
|
| test_extendsDisallowedClass_class_num() async {
|
| Source source = addSource("class A extends num {}");
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| test_extendsDisallowedClass_class_String() async {
|
| Source source = addSource("class A extends String {}");
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS,
|
| CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT
|
| ]);
|
| @@ -1962,8 +2066,8 @@ class C = a.A with M;'''
|
| Source source = addSource(r'''
|
| class M {}
|
| class C = bool with M;''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -1971,8 +2075,8 @@ class C = bool with M;''');
|
| Source source = addSource(r'''
|
| class M {}
|
| class C = double with M;''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -1980,8 +2084,8 @@ class C = double with M;''');
|
| Source source = addSource(r'''
|
| class M {}
|
| class C = int with M;''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -1989,8 +2093,8 @@ class C = int with M;''');
|
| Source source = addSource(r'''
|
| class M {}
|
| class C = Null with M;''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -1998,8 +2102,8 @@ class C = Null with M;''');
|
| Source source = addSource(r'''
|
| class M {}
|
| class C = num with M;''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -2007,8 +2111,8 @@ class C = num with M;''');
|
| Source source = addSource(r'''
|
| class M {}
|
| class C = String with M;''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -2016,7 +2120,8 @@ class C = String with M;''');
|
| Source source = addSource(r'''
|
| enum E { ONE }
|
| class A extends E {}''');
|
| - await assertErrors(source, [CompileTimeErrorCode.EXTENDS_ENUM]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.EXTENDS_ENUM]);
|
| verify([source]);
|
| }
|
|
|
| @@ -2024,13 +2129,15 @@ class A extends E {}''');
|
| Source source = addSource(r'''
|
| int A;
|
| class B extends A {}''');
|
| - await assertErrors(source, [CompileTimeErrorCode.EXTENDS_NON_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.EXTENDS_NON_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| test_extendsNonClass_dynamic() async {
|
| Source source = addSource("class B extends dynamic {}");
|
| - await assertErrors(source, [CompileTimeErrorCode.EXTENDS_NON_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.EXTENDS_NON_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -2042,8 +2149,8 @@ class A {
|
| main() {
|
| const A(0);
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -2055,8 +2162,8 @@ class A {
|
| class B extends A {
|
| const B() : super(0);
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -2066,7 +2173,8 @@ class A {
|
| int x;
|
| A(this.x) : x = 3 {}
|
| }''');
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER]);
|
| verify([source]);
|
| }
|
| @@ -2077,7 +2185,8 @@ class A {
|
| int x;
|
| A() : x = 0, x = 1 {}
|
| }''');
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS]);
|
| verify([source]);
|
| }
|
| @@ -2088,7 +2197,8 @@ class A {
|
| int x;
|
| A() : x = 0, x = 1, x = 2 {}
|
| }''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS,
|
| CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS
|
| ]);
|
| @@ -2102,7 +2212,8 @@ class A {
|
| int y;
|
| A() : x = 0, x = 1, y = 0, y = 1 {}
|
| }''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS,
|
| CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS
|
| ]);
|
| @@ -2115,7 +2226,8 @@ class A {
|
| int x;
|
| A(this.x) : x = 1 {}
|
| }''');
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER]);
|
| verify([source]);
|
| }
|
| @@ -2126,7 +2238,8 @@ class A {
|
| int x;
|
| factory A(this.x) => null;
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.FIELD_INITIALIZER_FACTORY_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
| @@ -2138,7 +2251,8 @@ class A {
|
| int x;
|
| m(this.x) {}
|
| }''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| ParserErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR,
|
| CompileTimeErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR
|
| ]);
|
| @@ -2151,7 +2265,8 @@ class A {
|
| int x;
|
| m([this.x]) {}
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
| @@ -2162,7 +2277,8 @@ class A {
|
| int x;
|
| A(int p(this.x));
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
| @@ -2174,7 +2290,8 @@ class A {
|
| A.named() {}
|
| A() : this.named(), x = 42;
|
| }''');
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
| @@ -2186,7 +2303,8 @@ class A {
|
| A.named() {}
|
| A() : x = 42, this.named();
|
| }''');
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
| @@ -2198,7 +2316,8 @@ class A {
|
| A.named() {}
|
| A(this.x) : this.named();
|
| }''');
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
| @@ -2209,7 +2328,8 @@ class A {
|
| final x;
|
| A() : x = 0, x = 0 {}
|
| }''');
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS]);
|
| verify([source]);
|
| }
|
| @@ -2228,7 +2348,8 @@ class A {
|
| final x;
|
| A(this.x) : x = 0 {}
|
| }''');
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER]);
|
| verify([source]);
|
| }
|
| @@ -2240,7 +2361,8 @@ class A {
|
| A(this.x, this.x) {}
|
| }''');
|
| // TODO(brianwilkerson) There should only be one error here.
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.DUPLICATE_DEFINITION,
|
| CompileTimeErrorCode.FINAL_INITIALIZED_MULTIPLE_TIMES
|
| ]);
|
| @@ -2252,13 +2374,15 @@ class A {
|
| class A {
|
| static const F;
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.CONST_NOT_INITIALIZED]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.CONST_NOT_INITIALIZED]);
|
| verify([source]);
|
| }
|
|
|
| test_finalNotInitialized_library_const() async {
|
| Source source = addSource("const F;");
|
| - await assertErrors(source, [CompileTimeErrorCode.CONST_NOT_INITIALIZED]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.CONST_NOT_INITIALIZED]);
|
| verify([source]);
|
| }
|
|
|
| @@ -2267,7 +2391,8 @@ class A {
|
| f() {
|
| const int x;
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.CONST_NOT_INITIALIZED]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.CONST_NOT_INITIALIZED]);
|
| verify([source]);
|
| }
|
|
|
| @@ -2275,7 +2400,8 @@ f() {
|
| Source source = addSource(r'''
|
| var b1 = const bool.fromEnvironment(1);
|
| var b2 = const bool.fromEnvironment('x', defaultValue: 1);''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION,
|
| StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE,
|
| CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION,
|
| @@ -2290,7 +2416,8 @@ 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 assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION,
|
| StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
| ]);
|
| @@ -2303,7 +2430,8 @@ class A {
|
| x(y) {}
|
| get x => 0;
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.GETTER_AND_METHOD_WITH_SAME_NAME]);
|
| verify([source]);
|
| }
|
| @@ -2340,49 +2468,50 @@ class C = B with M implements a.A;'''
|
|
|
| test_implementsDisallowedClass_class_bool() async {
|
| Source source = addSource("class A implements bool {}");
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| test_implementsDisallowedClass_class_double() async {
|
| Source source = addSource("class A implements double {}");
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| test_implementsDisallowedClass_class_int() async {
|
| Source source = addSource("class A implements int {}");
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| test_implementsDisallowedClass_class_Null() async {
|
| Source source = addSource("class A implements Null {}");
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| test_implementsDisallowedClass_class_num() async {
|
| Source source = addSource("class A implements num {}");
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| test_implementsDisallowedClass_class_String() async {
|
| Source source = addSource("class A implements String {}");
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| test_implementsDisallowedClass_class_String_num() async {
|
| Source source = addSource("class A implements String, num {}");
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS,
|
| CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS
|
| ]);
|
| @@ -2394,8 +2523,8 @@ class C = B with M implements a.A;'''
|
| class A {}
|
| class M {}
|
| class C = A with M implements bool;''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -2404,8 +2533,8 @@ class C = A with M implements bool;''');
|
| class A {}
|
| class M {}
|
| class C = A with M implements double;''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -2414,8 +2543,8 @@ class C = A with M implements double;''');
|
| class A {}
|
| class M {}
|
| class C = A with M implements int;''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -2424,8 +2553,8 @@ class C = A with M implements int;''');
|
| class A {}
|
| class M {}
|
| class C = A with M implements Null;''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -2434,8 +2563,8 @@ class C = A with M implements Null;''');
|
| class A {}
|
| class M {}
|
| class C = A with M implements num;''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -2444,8 +2573,8 @@ class C = A with M implements num;''');
|
| class A {}
|
| class M {}
|
| class C = A with M implements String;''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -2454,7 +2583,8 @@ class C = A with M implements String;''');
|
| class A {}
|
| class M {}
|
| class C = A with M implements String, num;''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS,
|
| CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS
|
| ]);
|
| @@ -2463,7 +2593,8 @@ class C = A with M implements String, num;''');
|
|
|
| test_implementsDynamic() async {
|
| Source source = addSource("class A implements dynamic {}");
|
| - await assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DYNAMIC]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DYNAMIC]);
|
| verify([source]);
|
| }
|
|
|
| @@ -2471,7 +2602,8 @@ class C = A with M implements String, num;''');
|
| Source source = addSource(r'''
|
| enum E { ONE }
|
| class A implements E {}''');
|
| - await assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_ENUM]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_ENUM]);
|
| verify([source]);
|
| }
|
|
|
| @@ -2479,7 +2611,8 @@ class A implements E {}''');
|
| Source source = addSource(r'''
|
| int A;
|
| class B implements A {}''');
|
| - await assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_NON_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_NON_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -2489,7 +2622,8 @@ class A {}
|
| class M {}
|
| int B;
|
| class C = A with M implements B;''');
|
| - await assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_NON_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_NON_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -2497,7 +2631,8 @@ class C = A with M implements B;''');
|
| Source source = addSource(r'''
|
| class A {}
|
| class B implements A, A {}''');
|
| - await assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_REPEATED]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_REPEATED]);
|
| verify([source]);
|
| }
|
|
|
| @@ -2505,7 +2640,8 @@ class B implements A, A {}''');
|
| Source source = addSource(r'''
|
| class A {} class C{}
|
| class B implements A, A, A, A {}''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.IMPLEMENTS_REPEATED,
|
| CompileTimeErrorCode.IMPLEMENTS_REPEATED,
|
| CompileTimeErrorCode.IMPLEMENTS_REPEATED
|
| @@ -2517,13 +2653,15 @@ class B implements A, A, A, A {}''');
|
| Source source = addSource(r'''
|
| class A {}
|
| class B extends A implements A {}''');
|
| - await assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_SUPER_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_SUPER_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| test_implementsSuperClass_Object() async {
|
| Source source = addSource("class A implements Object {}");
|
| - await assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_SUPER_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_SUPER_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -2534,7 +2672,8 @@ class A {
|
| A() : v = f;
|
| var f;
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]);
|
| verify([source]);
|
| }
|
| @@ -2545,7 +2684,8 @@ class A {
|
| final x = 0;
|
| final y = x;
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]);
|
| verify([source]);
|
| }
|
| @@ -2557,7 +2697,8 @@ class A {
|
| A() : v = f();
|
| f() {}
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]);
|
| verify([source]);
|
| }
|
| @@ -2568,7 +2709,8 @@ class A {
|
| static var F = m();
|
| m() {}
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]);
|
| verify([source]);
|
| }
|
| @@ -2580,7 +2722,8 @@ class A {
|
| A.named() : this(f);
|
| var f;
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]);
|
| verify([source]);
|
| }
|
| @@ -2594,7 +2737,8 @@ class B extends A {
|
| B() : super(f);
|
| var f;
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]);
|
| verify([source]);
|
| }
|
| @@ -2606,7 +2750,8 @@ 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 assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY, HintCode.UNUSED_IMPORT]);
|
| verify([source]);
|
| }
|
| @@ -2618,7 +2763,8 @@ 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 assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY, HintCode.UNUSED_IMPORT]);
|
| verify([source]);
|
| }
|
| @@ -2633,7 +2779,8 @@ A a;''');
|
| r'''
|
| part of lib;
|
| class A{}''');
|
| - await assertErrors(source, [CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY]);
|
| verify([source]);
|
| }
|
|
|
| @@ -2647,7 +2794,8 @@ f(var p) {
|
| break;
|
| }
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES]);
|
| verify([source]);
|
| }
|
| @@ -2672,7 +2820,8 @@ foo(var p) {
|
| break;
|
| }
|
| }''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES,
|
| CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES
|
| ]);
|
| @@ -2691,7 +2840,8 @@ f(var p) {
|
| break;
|
| }
|
| }''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES,
|
| CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES
|
| ]);
|
| @@ -2706,7 +2856,8 @@ class A {
|
| const A() : x = 'foo';
|
| }
|
| A a = const A();''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.INITIALIZER_FOR_NON_EXISTENT_FIELD]);
|
| }
|
|
|
| @@ -2715,7 +2866,8 @@ A a = const A();''');
|
| class A {
|
| A() : x = 0 {}
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.INITIALIZER_FOR_NON_EXISTENT_FIELD]);
|
| }
|
|
|
| @@ -2725,8 +2877,8 @@ class A {
|
| static int x;
|
| A() : x = 0 {}
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.INITIALIZER_FOR_STATIC_FIELD]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INITIALIZER_FOR_STATIC_FIELD]);
|
| verify([source]);
|
| }
|
|
|
| @@ -2735,7 +2887,8 @@ class A {
|
| class A {
|
| A(this.x) {}
|
| }''');
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD]);
|
| verify([source]);
|
| }
|
| @@ -2748,7 +2901,8 @@ int x;
|
| class B extends A {
|
| B(this.x) {}
|
| }''');
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD]);
|
| verify([source]);
|
| }
|
| @@ -2758,7 +2912,8 @@ class B extends A {
|
| class A {
|
| A([this.x]) {}
|
| }''');
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD]);
|
| verify([source]);
|
| }
|
| @@ -2769,7 +2924,8 @@ class A {
|
| int get x => 1;
|
| A(this.x) {}
|
| }''');
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD]);
|
| verify([source]);
|
| }
|
| @@ -2780,7 +2936,8 @@ class A {
|
| static int x;
|
| A([this.x]) {}
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_STATIC_FIELD]);
|
| verify([source]);
|
| }
|
| @@ -2795,7 +2952,8 @@ class A {
|
| return new A();
|
| }
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_FACTORY]);
|
| verify([source]);
|
| }
|
| @@ -2810,7 +2968,8 @@ class A {
|
| return new A._();
|
| }
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_FACTORY]);
|
| verify([source]);
|
| }
|
| @@ -2823,7 +2982,8 @@ class A {
|
| f;
|
| }
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_STATIC]);
|
| verify([source]);
|
| }
|
| @@ -2836,7 +2996,8 @@ class A {
|
| g;
|
| }
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_STATIC]);
|
| verify([source]);
|
| }
|
| @@ -2849,7 +3010,8 @@ class A {
|
| m();
|
| }
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_STATIC]);
|
| verify([source]);
|
| }
|
| @@ -2860,7 +3022,8 @@ enum E { ONE }
|
| E e(String name) {
|
| return const E();
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.INSTANTIATE_ENUM]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INSTANTIATE_ENUM]);
|
| verify([source]);
|
| }
|
|
|
| @@ -2870,7 +3033,8 @@ enum E { ONE }
|
| E e(String name) {
|
| return new E();
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.INSTANTIATE_ENUM]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INSTANTIATE_ENUM]);
|
| verify([source]);
|
| }
|
|
|
| @@ -2880,7 +3044,8 @@ get V => 0;
|
| @V
|
| main() {
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| verify([source]);
|
| }
|
|
|
| @@ -2895,7 +3060,8 @@ import 'lib.dart' as p;
|
| @p.V
|
| main() {
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| verify([source]);
|
| }
|
|
|
| @@ -2910,7 +3076,8 @@ import 'lib.dart' as p;
|
| @p.V
|
| main() {
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| verify([source]);
|
| }
|
|
|
| @@ -2925,7 +3092,8 @@ import 'lib.dart' as p;
|
| @p.V
|
| main() {
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| verify([source]);
|
| }
|
|
|
| @@ -2935,7 +3103,8 @@ final V = 0;
|
| @V
|
| main() {
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| verify([source]);
|
| }
|
|
|
| @@ -2945,7 +3114,8 @@ typedef V();
|
| @V
|
| main() {
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| verify([source]);
|
| }
|
|
|
| @@ -2957,7 +3127,8 @@ class A {
|
| @A.f
|
| main() {
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| verify([source]);
|
| }
|
|
|
| @@ -2966,7 +3137,8 @@ main() {
|
| @unresolved
|
| main() {
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| }
|
|
|
| test_invalidAnnotation_unresolved_invocation() async {
|
| @@ -2974,7 +3146,8 @@ main() {
|
| @Unresolved()
|
| main() {
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| }
|
|
|
| test_invalidAnnotation_unresolved_prefixedIdentifier() async {
|
| @@ -2983,7 +3156,8 @@ import 'dart:math' as p;
|
| @p.unresolved
|
| main() {
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| }
|
|
|
| test_invalidAnnotation_useLibraryScope() async {
|
| @@ -2992,7 +3166,8 @@ main() {
|
| class A {
|
| static const foo = null;
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
|
| }
|
|
|
| test_invalidAnnotationFromDeferredLibrary() async {
|
| @@ -3047,8 +3222,8 @@ class A {
|
| B() : super();
|
| }
|
| class B {}''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME]);
|
| // no verify() call, "B" is not resolved
|
| }
|
|
|
| @@ -3057,8 +3232,8 @@ class B {}''');
|
| class A {
|
| B() : super();
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME]);
|
| // no verify() call, "B" is not resolved
|
| }
|
|
|
| @@ -3068,7 +3243,8 @@ int B;
|
| class A {
|
| factory B() => null;
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.INVALID_FACTORY_NAME_NOT_A_CLASS]);
|
| verify([source]);
|
| }
|
| @@ -3078,7 +3254,8 @@ class A {
|
| class A {
|
| factory B() => null;
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.INVALID_FACTORY_NAME_NOT_A_CLASS]);
|
| // no verify() call, "B" is not resolved
|
| }
|
| @@ -3088,7 +3265,8 @@ class A {
|
| class A {
|
| A() async {}
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
| @@ -3098,7 +3276,8 @@ class A {
|
| class A {
|
| A() async* {}
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
| @@ -3108,7 +3287,8 @@ class A {
|
| class A {
|
| A() sync* {}
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
| @@ -3118,8 +3298,8 @@ class A {
|
| class A {
|
| set x(v) async {}
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3128,8 +3308,8 @@ class A {
|
| class A {
|
| set x(v) async* {}
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3138,29 +3318,29 @@ class A {
|
| class A {
|
| set x(v) sync* {}
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]);
|
| verify([source]);
|
| }
|
|
|
| test_invalidModifierOnSetter_topLevel_async() async {
|
| Source source = addSource("set x(v) async {}");
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]);
|
| verify([source]);
|
| }
|
|
|
| test_invalidModifierOnSetter_topLevel_asyncStar() async {
|
| Source source = addSource("set x(v) async* {}");
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]);
|
| verify([source]);
|
| }
|
|
|
| test_invalidModifierOnSetter_topLevel_syncStar() async {
|
| Source source = addSource("set x(v) sync* {}");
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3169,8 +3349,8 @@ class A {
|
| class A {
|
| factory A() { return this; }
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3180,8 +3360,8 @@ class A {
|
| var f;
|
| A() : f = this;
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3190,8 +3370,8 @@ class A {
|
| class A {
|
| var f = this;
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3200,8 +3380,8 @@ class A {
|
| class A {
|
| static m() { return this; }
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3210,8 +3390,8 @@ class A {
|
| class A {
|
| static A f = this;
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3223,22 +3403,22 @@ class A {
|
| class B extends A {
|
| B() : super(this);
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
|
| verify([source]);
|
| }
|
|
|
| test_invalidReferenceToThis_topLevelFunction() async {
|
| Source source = addSource("f() { return this; }");
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
|
| verify([source]);
|
| }
|
|
|
| test_invalidReferenceToThis_variableInitializer() async {
|
| Source source = addSource("int x = this;");
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3249,7 +3429,8 @@ class A<E> {
|
| return const <E>[];
|
| }
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_LIST]);
|
| verify([source]);
|
| }
|
| @@ -3261,26 +3442,30 @@ class A<E> {
|
| return const <String, E>{};
|
| }
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_MAP]);
|
| verify([source]);
|
| }
|
|
|
| test_invalidUri_export() async {
|
| Source source = addSource("export 'ht:';");
|
| - await assertErrors(source, [CompileTimeErrorCode.INVALID_URI]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INVALID_URI]);
|
| }
|
|
|
| test_invalidUri_import() async {
|
| Source source = addSource("import 'ht:';");
|
| - await assertErrors(source, [CompileTimeErrorCode.INVALID_URI]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INVALID_URI]);
|
| }
|
|
|
| test_invalidUri_part() async {
|
| Source source = addSource(r'''
|
| library lib;
|
| part 'ht:';''');
|
| - await assertErrors(source, [CompileTimeErrorCode.INVALID_URI]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.INVALID_URI]);
|
| }
|
|
|
| test_isInConstInstanceCreation_restored() async {
|
| @@ -3294,7 +3479,8 @@ class Foo<T extends num> {
|
| const x = const Foo<int>(const Foo<int>(0, 1),
|
| const <Foo<String>>[]); // (1)
|
| ''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
|
| verify([source]);
|
| }
|
| @@ -3315,7 +3501,8 @@ class Foo {
|
| _foo() {
|
| }
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]);
|
| verify([source]);
|
| }
|
| @@ -3331,7 +3518,8 @@ class A {
|
| }
|
| }
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.LABEL_IN_OUTER_SCOPE]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.LABEL_IN_OUTER_SCOPE]);
|
| // We cannot verify resolution with unresolvable labels
|
| }
|
|
|
| @@ -3342,7 +3530,8 @@ f() {
|
| break y;
|
| }
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.LABEL_UNDEFINED]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.LABEL_UNDEFINED]);
|
| // We cannot verify resolution with undefined labels
|
| }
|
|
|
| @@ -3353,7 +3542,8 @@ f() {
|
| continue y;
|
| }
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.LABEL_UNDEFINED]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.LABEL_UNDEFINED]);
|
| // We cannot verify resolution with undefined labels
|
| }
|
|
|
| @@ -3361,7 +3551,8 @@ 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 assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE,
|
| CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL,
|
| StaticTypeWarningCode.NON_BOOL_CONDITION
|
| @@ -3374,7 +3565,8 @@ f() {
|
| class A {
|
| int A = 0;
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3383,7 +3575,8 @@ class A {
|
| class A {
|
| int z, A, b = 0;
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3392,7 +3585,8 @@ class A {
|
| class A {
|
| get A => 0;
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3406,7 +3600,8 @@ class A {
|
| get x => 0;
|
| x(y) {}
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.METHOD_AND_GETTER_WITH_SAME_NAME]);
|
| verify([source]);
|
| }
|
| @@ -3417,8 +3612,8 @@ class A {
|
| A() {}
|
| }
|
| class B extends Object with A {}''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3428,8 +3623,8 @@ class A {
|
| A() {}
|
| }
|
| class B = Object with A;''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3470,8 +3665,8 @@ class B {
|
| class M {}
|
| class C = B with M;
|
| ''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3487,8 +3682,8 @@ 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 assertErrors(
|
| - source, [CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3506,8 +3701,8 @@ 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 assertErrors(
|
| - source, [CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3525,8 +3720,8 @@ 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 assertErrors(
|
| - source, [CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3544,8 +3739,8 @@ 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 assertErrors(
|
| - source, [CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3554,8 +3749,8 @@ class C extends B with M {
|
| class A {}
|
| class B extends A {}
|
| class C extends Object with B {}''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3564,8 +3759,8 @@ class C extends Object with B {}''');
|
| class A {}
|
| class B extends Object with A {}
|
| class C extends Object with B {}''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3574,8 +3769,8 @@ class C extends Object with B {}''');
|
| class A {}
|
| class B extends A {}
|
| class C = Object with B;''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3584,50 +3779,50 @@ class C = Object with B;''');
|
| class A {}
|
| class B extends Object with A {}
|
| class C = Object with B;''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]);
|
| verify([source]);
|
| }
|
|
|
| test_mixinOfDisallowedClass_class_bool() async {
|
| Source source = addSource("class A extends Object with bool {}");
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| test_mixinOfDisallowedClass_class_double() async {
|
| Source source = addSource("class A extends Object with double {}");
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| test_mixinOfDisallowedClass_class_int() async {
|
| Source source = addSource("class A extends Object with int {}");
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| test_mixinOfDisallowedClass_class_Null() async {
|
| Source source = addSource("class A extends Object with Null {}");
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| test_mixinOfDisallowedClass_class_num() async {
|
| Source source = addSource("class A extends Object with num {}");
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| test_mixinOfDisallowedClass_class_String() async {
|
| Source source = addSource("class A extends Object with String {}");
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3635,8 +3830,8 @@ class C = Object with B;''');
|
| Source source = addSource(r'''
|
| class A {}
|
| class C = A with bool;''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3644,8 +3839,8 @@ class C = A with bool;''');
|
| Source source = addSource(r'''
|
| class A {}
|
| class C = A with double;''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3653,8 +3848,8 @@ class C = A with double;''');
|
| Source source = addSource(r'''
|
| class A {}
|
| class C = A with int;''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3662,8 +3857,8 @@ class C = A with int;''');
|
| Source source = addSource(r'''
|
| class A {}
|
| class C = A with Null;''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3671,8 +3866,8 @@ class C = A with Null;''');
|
| Source source = addSource(r'''
|
| class A {}
|
| class C = A with num;''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3680,8 +3875,8 @@ class C = A with num;''');
|
| Source source = addSource(r'''
|
| class A {}
|
| class C = A with String;''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3689,7 +3884,8 @@ class C = A with String;''');
|
| Source source = addSource(r'''
|
| class A {}
|
| class C = A with String, num;''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS,
|
| CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS
|
| ]);
|
| @@ -3700,7 +3896,8 @@ class C = A with String, num;''');
|
| Source source = addSource(r'''
|
| enum E { ONE }
|
| class A extends Object with E {}''');
|
| - await assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_ENUM]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_ENUM]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3708,7 +3905,8 @@ class A extends Object with E {}''');
|
| Source source = addSource(r'''
|
| int A;
|
| class B extends Object with A {}''');
|
| - await assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_NON_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_NON_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3717,7 +3915,8 @@ class B extends Object with A {}''');
|
| class A {}
|
| int B;
|
| class C = A with B;''');
|
| - await assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_NON_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_NON_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3727,7 +3926,8 @@ class A {
|
| toString() => super.toString();
|
| }
|
| class B extends Object with A {}''');
|
| - await assertErrors(source, [CompileTimeErrorCode.MIXIN_REFERENCES_SUPER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.MIXIN_REFERENCES_SUPER]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3736,7 +3936,8 @@ class B extends Object with A {}''');
|
| int A;
|
| class B {}
|
| class C extends A with B {}''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.MIXIN_WITH_NON_CLASS_SUPERCLASS]);
|
| verify([source]);
|
| }
|
| @@ -3746,7 +3947,8 @@ class C extends A with B {}''');
|
| int A;
|
| class B {}
|
| class C = A with B;''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.MIXIN_WITH_NON_CLASS_SUPERCLASS]);
|
| verify([source]);
|
| }
|
| @@ -3758,7 +3960,8 @@ class A {
|
| A.a() {}
|
| A.b() {}
|
| }''');
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS]);
|
| verify([source]);
|
| }
|
| @@ -3769,8 +3972,8 @@ class A {}
|
| class B extends A {
|
| B() : super(), super() {}
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.MULTIPLE_SUPER_INITIALIZERS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.MULTIPLE_SUPER_INITIALIZERS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3779,8 +3982,8 @@ class B extends A {
|
| // error code is generated through the ErrorVerifier, it is not a
|
| // CompileTimeErrorCode.
|
| Source source = addSource("class A native 'string' {}");
|
| - await assertErrors(
|
| - source, [ParserErrorCode.NATIVE_CLAUSE_IN_NON_SDK_CODE]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [ParserErrorCode.NATIVE_CLAUSE_IN_NON_SDK_CODE]);
|
| verify([source]);
|
| }
|
|
|
| @@ -3789,7 +3992,8 @@ 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 assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [ParserErrorCode.NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE]);
|
| verify([source]);
|
| }
|
| @@ -3802,7 +4006,8 @@ class B extends A {
|
| class A{
|
| static int m(a) native 'string';
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [ParserErrorCode.NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE]);
|
| verify([source]);
|
| }
|
| @@ -3815,7 +4020,8 @@ class A {
|
| @A
|
| main() {
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS]);
|
| verify([source]);
|
| }
|
| @@ -3828,7 +4034,8 @@ class A {
|
| class B extends A {
|
| B() {}
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT]);
|
| verify([source]);
|
| }
|
| @@ -3845,7 +4052,8 @@ class C extends Mixed {
|
| C(x) : super();
|
| }
|
| ''');
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT]);
|
| verify([source]);
|
| }
|
| @@ -3862,7 +4070,8 @@ class C extends Mixed {
|
| C();
|
| }
|
| ''');
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT]);
|
| verify([source]);
|
| }
|
| @@ -3879,7 +4088,8 @@ class C extends Mixed {
|
| C(x) : super.named();
|
| }
|
| ''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER]);
|
| // Don't verify since call to super.named() can't be resolved.
|
| }
|
| @@ -3896,7 +4106,8 @@ class C extends Mixed {
|
| C();
|
| }
|
| ''');
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT]);
|
| verify([source]);
|
| }
|
| @@ -3912,7 +4123,8 @@ class C extends B with M {
|
| C(x) : super();
|
| }
|
| ''');
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT]);
|
| verify([source]);
|
| }
|
| @@ -3928,7 +4140,8 @@ class C extends B with M {
|
| C();
|
| }
|
| ''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT]);
|
| verify([source]);
|
| }
|
| @@ -3944,7 +4157,8 @@ class C extends B with M {
|
| C(x) : super.named();
|
| }
|
| ''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER]);
|
| // Don't verify since call to super.named() can't be resolved.
|
| }
|
| @@ -3960,7 +4174,8 @@ class C extends B with M {
|
| C();
|
| }
|
| ''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT]);
|
| verify([source]);
|
| }
|
| @@ -3975,7 +4190,8 @@ class B {
|
| class Mixed = B with M;
|
| class C extends Mixed {}
|
| ''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
|
| verify([source]);
|
| }
|
| @@ -3990,7 +4206,8 @@ class B {
|
| class Mixed = B with M;
|
| class C extends Mixed {}
|
| ''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
|
| verify([source]);
|
| }
|
| @@ -4004,7 +4221,8 @@ class B {
|
| }
|
| class C extends B with M {}
|
| ''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
|
| verify([source]);
|
| }
|
| @@ -4018,7 +4236,8 @@ class B {
|
| }
|
| class C extends B with M {}
|
| ''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
|
| verify([source]);
|
| }
|
| @@ -4030,7 +4249,8 @@ class A {
|
| }
|
| class B extends A {
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
|
| verify([source]);
|
| }
|
| @@ -4039,7 +4259,8 @@ class B extends A {
|
| Source source = addSource(r'''
|
| class A { A.named() {} }
|
| class B extends A {}''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
|
| verify([source]);
|
| }
|
| @@ -4052,7 +4273,8 @@ class A {
|
| @A.fromInt()
|
| main() {
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.NON_CONSTANT_ANNOTATION_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
| @@ -4065,7 +4287,8 @@ class A {
|
| @A()
|
| main() {
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.NON_CONSTANT_ANNOTATION_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
| @@ -4074,8 +4297,8 @@ main() {
|
| Source source = addSource(r'''
|
| int y;
|
| f({x : y}) {}''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
|
| verify([source]);
|
| }
|
|
|
| @@ -4083,8 +4306,8 @@ f({x : y}) {}''');
|
| Source source = addSource(r'''
|
| int y;
|
| f([x = y]) {}''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
|
| verify([source]);
|
| }
|
|
|
| @@ -4094,8 +4317,8 @@ class A {
|
| int y;
|
| A({x : y}) {}
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
|
| verify([source]);
|
| }
|
|
|
| @@ -4105,8 +4328,8 @@ class A {
|
| int y;
|
| A([x = y]) {}
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
|
| verify([source]);
|
| }
|
|
|
| @@ -4116,8 +4339,8 @@ class A {
|
| int y;
|
| m({x : y}) {}
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
|
| verify([source]);
|
| }
|
|
|
| @@ -4127,8 +4350,8 @@ class A {
|
| int y;
|
| m([x = y]) {}
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
|
| verify([source]);
|
| }
|
|
|
| @@ -4168,8 +4391,8 @@ f(int p, int q) {
|
| break;
|
| }
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.NON_CONSTANT_CASE_EXPRESSION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_CASE_EXPRESSION]);
|
| verify([source]);
|
| }
|
|
|
| @@ -4216,8 +4439,8 @@ main (int p) {
|
| f(a) {
|
| return const [a];
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.NON_CONSTANT_LIST_ELEMENT]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_LIST_ELEMENT]);
|
| verify([source]);
|
| }
|
|
|
| @@ -4258,7 +4481,8 @@ f() {
|
| f() {
|
| {'a' : 0, 'b' : 1}.length;
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.NON_CONST_MAP_AS_EXPRESSION_STATEMENT]);
|
| verify([source]);
|
| }
|
| @@ -4268,7 +4492,8 @@ f() {
|
| f() {
|
| {'a' : 0, 'b' : 1};
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.NON_CONST_MAP_AS_EXPRESSION_STATEMENT]);
|
| verify([source]);
|
| }
|
| @@ -4278,7 +4503,8 @@ f() {
|
| f(a) {
|
| return const {a : 0};
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_MAP_KEY]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_MAP_KEY]);
|
| verify([source]);
|
| }
|
|
|
| @@ -4319,7 +4545,8 @@ f() {
|
| f(a) {
|
| return const {'a' : a};
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE]);
|
| verify([source]);
|
| }
|
|
|
| @@ -4361,7 +4588,8 @@ f() {
|
| class A {
|
| const A(int i) : assert(i.isNegative);
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]);
|
| verify([source]);
|
| }
|
| @@ -4372,7 +4600,8 @@ class A {
|
| class A {
|
| const A(int i) : assert(i < 0, 'isNegative = ${i.isNegative}');
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]);
|
| verify([source]);
|
| }
|
| @@ -4383,7 +4612,8 @@ class A {
|
| final bool a;
|
| const A(String p) : a = p && true;
|
| }''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL,
|
| StaticTypeWarningCode.NON_BOOL_OPERAND
|
| ]);
|
| @@ -4396,7 +4626,8 @@ class A {
|
| final bool a;
|
| const A(String p) : a = true && p;
|
| }''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL,
|
| StaticTypeWarningCode.NON_BOOL_OPERAND
|
| ]);
|
| @@ -4409,7 +4640,8 @@ class A {
|
| final int a;
|
| const A(String p) : a = 5 & p;
|
| }''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.CONST_EVAL_TYPE_INT,
|
| StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
| ]);
|
| @@ -4422,7 +4654,8 @@ class A {
|
| final int a;
|
| const A(String p) : a = 5 + p;
|
| }''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.CONST_EVAL_TYPE_NUM,
|
| StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
| ]);
|
| @@ -4436,7 +4669,8 @@ class A {
|
| final int a;
|
| const A() : a = C;
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]);
|
| verify([source]);
|
| }
|
| @@ -4453,7 +4687,8 @@ class B {
|
| var b = const B();''');
|
| // TODO(paulberry): the error INVALID_CONSTAT is redundant and ought to be
|
| // suppressed.
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER,
|
| CompileTimeErrorCode.INVALID_CONSTANT
|
| ]);
|
| @@ -4467,7 +4702,8 @@ class A {
|
| const A.named(p);
|
| const A() : this.named(C);
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]);
|
| verify([source]);
|
| }
|
| @@ -4481,7 +4717,8 @@ class B extends A {
|
| static var C;
|
| const B() : super(C);
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]);
|
| verify([source]);
|
| }
|
| @@ -4568,8 +4805,8 @@ class A {
|
| class B extends A {
|
| B() : super.named();
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
|
|
| @@ -4581,8 +4818,8 @@ class A {
|
| class B extends A {
|
| B();
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
|
|
| @@ -4593,8 +4830,8 @@ class A {
|
| }
|
| class B extends A {
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
|
|
| @@ -4606,8 +4843,8 @@ class A {
|
| main() {
|
| const A();
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.NOT_ENOUGH_REQUIRED_ARGUMENTS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.NOT_ENOUGH_REQUIRED_ARGUMENTS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -4619,8 +4856,8 @@ class A {
|
| class B extends A {
|
| const B() : super();
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.NOT_ENOUGH_REQUIRED_ARGUMENTS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.NOT_ENOUGH_REQUIRED_ARGUMENTS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -4629,8 +4866,8 @@ class B extends A {
|
| class A {
|
| operator +({p}) {}
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.OPTIONAL_PARAMETER_IN_OPERATOR]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.OPTIONAL_PARAMETER_IN_OPERATOR]);
|
| verify([source]);
|
| }
|
|
|
| @@ -4639,8 +4876,8 @@ class A {
|
| class A {
|
| operator +([p]) {}
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.OPTIONAL_PARAMETER_IN_OPERATOR]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.OPTIONAL_PARAMETER_IN_OPERATOR]);
|
| verify([source]);
|
| }
|
|
|
| @@ -4649,7 +4886,8 @@ class A {
|
| library l1;
|
| part 'l2.dart';''');
|
| addNamedSource("/l2.dart", "library l2;");
|
| - await assertErrors(source, [CompileTimeErrorCode.PART_OF_NON_PART]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.PART_OF_NON_PART]);
|
| verify([source]);
|
| }
|
|
|
| @@ -4657,7 +4895,8 @@ part 'l2.dart';''');
|
| Source source = addSource(r'''
|
| library lib;
|
| part 'test.dart';''');
|
| - await assertErrors(source, [CompileTimeErrorCode.PART_OF_NON_PART]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.PART_OF_NON_PART]);
|
| verify([source]);
|
| }
|
|
|
| @@ -4671,7 +4910,8 @@ class C {
|
| }
|
| }
|
| ''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
|
| verify([source]);
|
| }
|
| @@ -4684,7 +4924,8 @@ f() {
|
| p += 1;
|
| }
|
| ''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
|
| verify([source]);
|
| }
|
| @@ -4699,7 +4940,8 @@ class C {
|
| }
|
| }
|
| ''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
|
| verify([source]);
|
| }
|
| @@ -4712,7 +4954,8 @@ f() {
|
| p = 1;
|
| }
|
| ''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
|
| verify([source]);
|
| }
|
| @@ -4730,7 +4973,8 @@ f() {
|
| p?.g();
|
| }
|
| ''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
|
| verify([source]);
|
| }
|
| @@ -4747,7 +4991,8 @@ f() {
|
| p?.loadLibrary();
|
| }
|
| ''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
|
| verify([source]);
|
| }
|
| @@ -4765,7 +5010,8 @@ f() {
|
| return p?.x;
|
| }
|
| ''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
|
| verify([source]);
|
| }
|
| @@ -4782,7 +5028,8 @@ f() {
|
| return p?.loadLibrary;
|
| }
|
| ''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
|
| verify([source]);
|
| }
|
| @@ -4800,7 +5047,8 @@ f() {
|
| p?.x = null;
|
| }
|
| ''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
|
| verify([source]);
|
| }
|
| @@ -4817,7 +5065,8 @@ f() {
|
| p?.loadLibrary = null;
|
| }
|
| ''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
|
| verify([source]);
|
| }
|
| @@ -4832,7 +5081,8 @@ class C {
|
| }
|
| }
|
| ''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
|
| verify([source]);
|
| }
|
| @@ -4845,7 +5095,8 @@ f() {
|
| p();
|
| }
|
| ''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
|
| verify([source]);
|
| }
|
| @@ -4860,7 +5111,8 @@ class A{}''');
|
| import 'lib.dart' as p;
|
| typedef p();
|
| p.A a;''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER]);
|
| verify([source]);
|
| }
|
| @@ -4875,7 +5127,8 @@ class A{}''');
|
| import 'lib.dart' as p;
|
| p() {}
|
| p.A a;''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER]);
|
| verify([source]);
|
| }
|
| @@ -4890,7 +5143,8 @@ class A{}''');
|
| import 'lib.dart' as p;
|
| var p = null;
|
| p.A a;''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER]);
|
| verify([source]);
|
| }
|
| @@ -4905,7 +5159,8 @@ class A{}''');
|
| import 'lib.dart' as p;
|
| class p {}
|
| p.A a;''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER]);
|
| verify([source]);
|
| }
|
| @@ -4918,7 +5173,8 @@ f() {
|
| return p;
|
| }
|
| ''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
|
| verify([source]);
|
| }
|
| @@ -4931,7 +5187,8 @@ f() {
|
| p += 1;
|
| }
|
| ''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
|
| verify([source]);
|
| }
|
| @@ -4949,15 +5206,16 @@ f() {
|
| p?.g();
|
| }
|
| ''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
|
| verify([source]);
|
| }
|
|
|
| test_privateOptionalParameter() async {
|
| Source source = addSource("f({var _p}) {}");
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]);
|
| verify([source]);
|
| }
|
|
|
| @@ -4967,15 +5225,15 @@ class A {
|
| var _p;
|
| A({this._p: 0});
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]);
|
| verify([source]);
|
| }
|
|
|
| test_privateOptionalParameter_withDefaultValue() async {
|
| Source source = addSource("f({_p : 0}) {}");
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]);
|
| verify([source]);
|
| }
|
|
|
| @@ -4985,7 +5243,8 @@ class A {
|
| const A();
|
| final m = const A();
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT]);
|
| verify([source]);
|
| }
|
| @@ -4994,7 +5253,8 @@ class A {
|
| Source source = addSource(r'''
|
| const x = y + 1;
|
| const y = x + 1;''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT,
|
| CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT
|
| ]);
|
| @@ -5009,7 +5269,8 @@ class C {
|
| final x;
|
| }
|
| ''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT]);
|
| verify([source]);
|
| }
|
| @@ -5018,7 +5279,8 @@ class C {
|
| Source source = addSource(r'''
|
| const x = x;
|
| ''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT]);
|
| verify([source]);
|
| }
|
| @@ -5029,7 +5291,8 @@ class A {
|
| A.a() : this.b();
|
| A.b() : this.a();
|
| }''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_CONSTRUCTOR_REDIRECT,
|
| CompileTimeErrorCode.RECURSIVE_CONSTRUCTOR_REDIRECT
|
| ]);
|
| @@ -5041,8 +5304,8 @@ class A {
|
| class A {
|
| A() : this();
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.RECURSIVE_CONSTRUCTOR_REDIRECT]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.RECURSIVE_CONSTRUCTOR_REDIRECT]);
|
| verify([source]);
|
| }
|
|
|
| @@ -5057,7 +5320,8 @@ class B implements C {
|
| class C implements A {
|
| factory C() = B;
|
| }''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT,
|
| CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT,
|
| CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT,
|
| @@ -5073,8 +5337,8 @@ class C implements A {
|
| class A {
|
| factory A() = A;
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT]);
|
| verify([source]);
|
| }
|
|
|
| @@ -5090,8 +5354,8 @@ main() {
|
| const C<int>();
|
| }
|
| ''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT]);
|
| verify([source]);
|
| }
|
|
|
| @@ -5106,7 +5370,8 @@ class B<T> implements C<T> {
|
| class C<T> implements A<T> {
|
| factory C() = B;
|
| }''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT,
|
| CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT,
|
| CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT,
|
| @@ -5128,7 +5393,8 @@ class B implements C {
|
| class C implements A {
|
| factory C.nameC() = B.nameB;
|
| }''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT,
|
| CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT,
|
| CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT,
|
| @@ -5154,7 +5420,8 @@ class B implements C {
|
| class C implements A, B {
|
| factory C() = B;
|
| }''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT,
|
| CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT,
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE,
|
| @@ -5167,7 +5434,8 @@ class C implements A, B {
|
| Source source = addSource(r'''
|
| class A extends B {}
|
| class B extends A {}''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE,
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE
|
| ]);
|
| @@ -5178,7 +5446,8 @@ class B extends A {}''');
|
| Source source = addSource(r'''
|
| class A extends B {}
|
| class B implements A {}''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE,
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE
|
| ]);
|
| @@ -5189,7 +5458,8 @@ class B implements A {}''');
|
| Source source = addSource(r'''
|
| class A implements B {}
|
| class B implements A {}''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE,
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE
|
| ]);
|
| @@ -5200,7 +5470,8 @@ class B implements A {}''');
|
| Source source = addSource(r'''
|
| class M1 = Object with M2;
|
| class M2 = Object with M1;''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE,
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE
|
| ]);
|
| @@ -5215,7 +5486,8 @@ class C = D with M;
|
| class D = C with M;
|
| class M {}
|
| ''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE,
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE
|
| ]);
|
| @@ -5226,7 +5498,8 @@ class M {}
|
| Source source = addSource(r'''
|
| abstract class A implements A {}
|
| class B implements A {}''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS
|
| ]);
|
| verify([source]);
|
| @@ -5237,7 +5510,8 @@ class B implements A {}''');
|
| abstract class A implements B {}
|
| abstract class B implements A {}
|
| class C implements A {}''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE,
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE
|
| ]);
|
| @@ -5250,7 +5524,8 @@ abstract class A implements B {}
|
| abstract class B implements C {}
|
| abstract class C implements A {}
|
| class D implements A {}''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE,
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE,
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE
|
| @@ -5260,7 +5535,8 @@ class D implements A {}''');
|
|
|
| test_recursiveInterfaceInheritanceBaseCaseExtends() async {
|
| Source source = addSource("class A extends A {}");
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS
|
| ]);
|
| verify([source]);
|
| @@ -5273,7 +5549,8 @@ class C extends C {
|
| m();
|
| }
|
| ''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS,
|
| StaticWarningCode.CONCRETE_CLASS_WITH_ABSTRACT_MEMBER,
|
| StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE
|
| @@ -5283,7 +5560,8 @@ class C extends C {
|
|
|
| test_recursiveInterfaceInheritanceBaseCaseImplements() async {
|
| Source source = addSource("class A implements A {}");
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS
|
| ]);
|
| verify([source]);
|
| @@ -5294,7 +5572,8 @@ class C extends C {
|
| class A {}
|
| class M {}
|
| class B = A with M implements B;''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS
|
| ]);
|
| verify([source]);
|
| @@ -5302,7 +5581,8 @@ class B = A with M implements B;''');
|
|
|
| test_recursiveInterfaceInheritanceBaseCaseWith() async {
|
| Source source = addSource("class M = Object with M;");
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_WITH]);
|
| verify([source]);
|
| }
|
| @@ -5312,7 +5592,8 @@ class B = A with M implements B;''');
|
| class A {
|
| A() : this.noSuchConstructor();
|
| }''');
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.REDIRECT_GENERATIVE_TO_MISSING_CONSTRUCTOR]);
|
| }
|
|
|
| @@ -5322,7 +5603,8 @@ class A {
|
| A() : this.x();
|
| factory A.x() => null;
|
| }''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.REDIRECT_GENERATIVE_TO_NON_GENERATIVE_CONSTRUCTOR
|
| ]);
|
| verify([source]);
|
| @@ -5336,7 +5618,8 @@ class A implements B{
|
| class B {
|
| const factory B() = A.name;
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.REDIRECT_TO_MISSING_CONSTRUCTOR]);
|
| }
|
|
|
| @@ -5348,7 +5631,8 @@ class A implements B{
|
| class B {
|
| const factory B() = A;
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.REDIRECT_TO_MISSING_CONSTRUCTOR]);
|
| }
|
|
|
| @@ -5358,7 +5642,8 @@ int A;
|
| class B {
|
| const factory B() = A;
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.REDIRECT_TO_NON_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.REDIRECT_TO_NON_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -5367,7 +5652,8 @@ class B {
|
| class B {
|
| const factory B() = A;
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.REDIRECT_TO_NON_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.REDIRECT_TO_NON_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -5377,7 +5663,8 @@ class A {
|
| A.a() {}
|
| const factory A.b() = A.a;
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.REDIRECT_TO_NON_CONST_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
| @@ -5390,8 +5677,8 @@ main() {
|
| v() {}
|
| }
|
| print(x) {}''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
|
| }
|
|
|
| test_referencedBeforeDeclaration_hideInBlock_local() async {
|
| @@ -5402,8 +5689,8 @@ main() {
|
| var v = 2;
|
| }
|
| print(x) {}''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
|
| }
|
|
|
| test_referencedBeforeDeclaration_hideInBlock_subBlock() async {
|
| @@ -5416,8 +5703,8 @@ main() {
|
| var v = 2;
|
| }
|
| print(x) {}''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
|
| }
|
|
|
| test_referencedBeforeDeclaration_inInitializer_closure() async {
|
| @@ -5425,8 +5712,8 @@ print(x) {}''');
|
| main() {
|
| var v = () => v;
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
|
| }
|
|
|
| test_referencedBeforeDeclaration_inInitializer_directly() async {
|
| @@ -5434,8 +5721,8 @@ main() {
|
| main() {
|
| var v = v;
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
|
| }
|
|
|
| test_referencedBeforeDeclaration_type_localFunction() async {
|
| @@ -5445,8 +5732,8 @@ void testTypeRef() {
|
| int String(int x) => x + 1;
|
| }
|
| ''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
|
| }
|
|
|
| test_referencedBeforeDeclaration_type_localVariable() async {
|
| @@ -5456,8 +5743,8 @@ void testTypeRef() {
|
| var String = '';
|
| }
|
| ''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
|
| }
|
|
|
| test_rethrowOutsideCatch() async {
|
| @@ -5465,7 +5752,8 @@ void testTypeRef() {
|
| f() {
|
| rethrow;
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.RETHROW_OUTSIDE_CATCH]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.RETHROW_OUTSIDE_CATCH]);
|
| verify([source]);
|
| }
|
|
|
| @@ -5474,7 +5762,8 @@ f() {
|
| class A {
|
| A() { return 0; }
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.RETURN_IN_GENERATIVE_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
| @@ -5484,7 +5773,8 @@ class A {
|
| class A {
|
| A() => null;
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.RETURN_IN_GENERATIVE_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
| @@ -5494,7 +5784,8 @@ class A {
|
| f() async* {
|
| return 0;
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.RETURN_IN_GENERATOR]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.RETURN_IN_GENERATOR]);
|
| verify([source]);
|
| }
|
|
|
| @@ -5503,7 +5794,8 @@ f() async* {
|
| f() sync* {
|
| return 0;
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.RETURN_IN_GENERATOR]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.RETURN_IN_GENERATOR]);
|
| verify([source]);
|
| }
|
|
|
| @@ -5527,8 +5819,8 @@ main() { lib.f1(); lib.f2(); }'''
|
|
|
| test_superInInvalidContext_binaryExpression() async {
|
| Source source = addSource("var v = super + 0;");
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
|
| // no verify(), 'super.v' is not resolved
|
| }
|
|
|
| @@ -5541,8 +5833,8 @@ class B extends A {
|
| var f;
|
| B() : f = super.m();
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
|
| // no verify(), 'super.m' is not resolved
|
| }
|
|
|
| @@ -5557,8 +5849,8 @@ class B extends A {
|
| return null;
|
| }
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
|
| // no verify(), 'super.m' is not resolved
|
| }
|
|
|
| @@ -5570,8 +5862,8 @@ class A {
|
| class B extends A {
|
| var b = super.a;
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
|
| // no verify(), 'super.a' is not resolved
|
| }
|
|
|
| @@ -5583,8 +5875,8 @@ class A {
|
| class B extends A {
|
| static n() { return super.m(); }
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
|
| // no verify(), 'super.m' is not resolved
|
| }
|
|
|
| @@ -5596,8 +5888,8 @@ class A {
|
| class B extends A {
|
| static int b = super.a;
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
|
| // no verify(), 'super.a' is not resolved
|
| }
|
|
|
| @@ -5606,15 +5898,15 @@ class B extends A {
|
| f() {
|
| super.f();
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
|
| // no verify(), 'super.f' is not resolved
|
| }
|
|
|
| test_superInInvalidContext_topLevelVariableInitializer() async {
|
| Source source = addSource("var v = super.y;");
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
|
| // no verify(), 'super.y' is not resolved
|
| }
|
|
|
| @@ -5625,7 +5917,8 @@ class B {
|
| B() : this.name(), super();
|
| B.name() {}
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.SUPER_IN_REDIRECTING_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
| @@ -5637,7 +5930,8 @@ class B {
|
| B() : super(), this.name();
|
| B.name() {}
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.SUPER_IN_REDIRECTING_CONSTRUCTOR]);
|
| verify([source]);
|
| }
|
| @@ -5649,7 +5943,8 @@ var s2 = const Symbol(3);
|
| var s3 = const Symbol();
|
| var s4 = const Symbol('x', 'y');
|
| var s5 = const Symbol('x', foo: 'x');''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION,
|
| CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION,
|
| StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE,
|
| @@ -5667,7 +5962,8 @@ typedef void G(List<F> l);
|
| main() {
|
| F foo(G g) => g;
|
| }''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF,
|
| CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF
|
| ]);
|
| @@ -5685,34 +5981,39 @@ abstract class D {
|
| abstract class E extends A<dynamic, F> {}
|
| typedef D F();
|
| ''');
|
| - await assertNoErrors(source);
|
| + await computeAnalysisResult(source);
|
| + assertNoErrors(source);
|
| verify([source]);
|
| }
|
|
|
| test_typeAliasCannotReferenceItself_parameterType_named() async {
|
| Source source = addSource("typedef A({A a});");
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]);
|
| verify([source]);
|
| }
|
|
|
| test_typeAliasCannotReferenceItself_parameterType_positional() async {
|
| Source source = addSource("typedef A([A a]);");
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]);
|
| verify([source]);
|
| }
|
|
|
| test_typeAliasCannotReferenceItself_parameterType_required() async {
|
| Source source = addSource("typedef A(A a);");
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]);
|
| verify([source]);
|
| }
|
|
|
| test_typeAliasCannotReferenceItself_parameterType_typeArgument() async {
|
| Source source = addSource("typedef A(List<A> a);");
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]);
|
| verify([source]);
|
| }
|
| @@ -5725,13 +6026,15 @@ typedef A B();
|
| class C {
|
| B a;
|
| }''');
|
| - await assertNoErrors(source);
|
| + await computeAnalysisResult(source);
|
| + assertNoErrors(source);
|
| verify([source]);
|
| }
|
|
|
| test_typeAliasCannotReferenceItself_returnType() async {
|
| Source source = addSource("typedef A A();");
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]);
|
| verify([source]);
|
| }
|
| @@ -5740,7 +6043,8 @@ class C {
|
| Source source = addSource(r'''
|
| typedef B A();
|
| typedef A B();''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF,
|
| CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF
|
| ]);
|
| @@ -5749,7 +6053,8 @@ typedef A B();''');
|
|
|
| test_typeAliasCannotReferenceItself_typeVariableBounds() async {
|
| Source source = addSource("typedef A<T extends A>();");
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]);
|
| verify([source]);
|
| }
|
| @@ -5762,7 +6067,8 @@ class G<E extends A> {
|
| const G();
|
| }
|
| f() { return const G<B>(); }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
|
| verify([source]);
|
| }
|
| @@ -5772,7 +6078,8 @@ f() { return const G<B>(); }''');
|
| f() {
|
| return const A();
|
| }''');
|
| - await assertErrors(source, [CompileTimeErrorCode.UNDEFINED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.UNDEFINED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -5782,7 +6089,8 @@ class A {}
|
| class B extends A {
|
| B() : super.named();
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER]);
|
| // no verify(), "super.named()" is not resolved
|
| }
|
| @@ -5795,7 +6103,8 @@ class A {
|
| class B extends A {
|
| B() : super();
|
| }''');
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT]);
|
| verify([source]);
|
| }
|
| @@ -5808,7 +6117,8 @@ class A {
|
| class B extends A {
|
| B();
|
| }''');
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT]);
|
| verify([source]);
|
| }
|
| @@ -5821,37 +6131,42 @@ class A {
|
| main() {
|
| const A(p: 0);
|
| }''');
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.UNDEFINED_NAMED_PARAMETER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.UNDEFINED_NAMED_PARAMETER]);
|
| // no verify(), 'p' is not resolved
|
| }
|
|
|
| test_uriDoesNotExist_export() async {
|
| Source source = addSource("export 'unknown.dart';");
|
| - await assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
|
| }
|
|
|
| test_uriDoesNotExist_import() async {
|
| Source source = addSource("import 'unknown.dart';");
|
| - await assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
|
| + await computeAnalysisResult(source);
|
| + 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 assertErrors(test, [HintCode.UNUSED_IMPORT]);
|
| + await computeAnalysisResult(test);
|
| + assertErrors(test, [HintCode.UNUSED_IMPORT]);
|
|
|
| // Remove the overlay in the same way as AnalysisServer.
|
| analysisContext2.setContents(target, null);
|
| ChangeSet changeSet = new ChangeSet()..removedSource(target);
|
| analysisContext2.applyChanges(changeSet);
|
|
|
| - await assertErrors(test, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
|
| + await computeAnalysisResult(test);
|
| + assertErrors(test, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
|
| }
|
|
|
| test_uriDoesNotExist_import_disappears_when_fixed() async {
|
| Source source = addSource("import 'target.dart';");
|
| - await assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
|
|
|
| // Check that the file is represented as missing.
|
| Source target = analysisContext2
|
| @@ -5865,19 +6180,22 @@ main() {
|
| ..handleContentsChanged(target, null, "", true);
|
|
|
| // Make sure the error goes away.
|
| - await assertErrors(source, [HintCode.UNUSED_IMPORT]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [HintCode.UNUSED_IMPORT]);
|
| }
|
|
|
| test_uriDoesNotExist_part() async {
|
| Source source = addSource(r'''
|
| library lib;
|
| part 'unknown.dart';''');
|
| - await assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
|
| }
|
|
|
| test_uriWithInterpolation_constant() async {
|
| Source source = addSource("import 'stuff_\$platform.dart';");
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.URI_WITH_INTERPOLATION,
|
| StaticWarningCode.UNDEFINED_IDENTIFIER
|
| ]);
|
| @@ -5889,7 +6207,8 @@ part 'unknown.dart';''');
|
| Source source = addSource(r'''
|
| library lib;
|
| part '${'a'}.dart';''');
|
| - await assertErrors(source, [CompileTimeErrorCode.URI_WITH_INTERPOLATION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.URI_WITH_INTERPOLATION]);
|
| // We cannot verify resolution with an unresolvable URI: '${'a'}.dart'
|
| }
|
|
|
| @@ -5916,7 +6235,8 @@ part '${'a'}.dart';''');
|
| class A {
|
| operator -(a, b) {}
|
| }''');
|
| - await assertErrors(source,
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source,
|
| [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINUS]);
|
| verify([source]);
|
| reset();
|
| @@ -5929,28 +6249,32 @@ class A {
|
|
|
| test_wrongNumberOfParametersForSetter_function_named() async {
|
| Source source = addSource("set x({p}) {}");
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]);
|
| verify([source]);
|
| }
|
|
|
| test_wrongNumberOfParametersForSetter_function_optional() async {
|
| Source source = addSource("set x([p]) {}");
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]);
|
| verify([source]);
|
| }
|
|
|
| test_wrongNumberOfParametersForSetter_function_tooFew() async {
|
| Source source = addSource("set x() {}");
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]);
|
| verify([source]);
|
| }
|
|
|
| test_wrongNumberOfParametersForSetter_function_tooMany() async {
|
| Source source = addSource("set x(a, b) {}");
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]);
|
| verify([source]);
|
| }
|
| @@ -5960,7 +6284,8 @@ class A {
|
| class A {
|
| set x({p}) {}
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]);
|
| verify([source]);
|
| }
|
| @@ -5970,7 +6295,8 @@ class A {
|
| class A {
|
| set x([p]) {}
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]);
|
| verify([source]);
|
| }
|
| @@ -5980,7 +6306,8 @@ class A {
|
| class A {
|
| set x() {}
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]);
|
| verify([source]);
|
| }
|
| @@ -5990,7 +6317,8 @@ class A {
|
| class A {
|
| set x(a, b) {}
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]);
|
| verify([source]);
|
| }
|
| @@ -6001,8 +6329,8 @@ f() async {
|
| var yield = 1;
|
| }
|
| ''');
|
| - await assertErrors(
|
| - source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| @@ -6012,8 +6340,8 @@ f() async* {
|
| var yield = 1;
|
| }
|
| ''');
|
| - await assertErrors(
|
| - source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| @@ -6023,8 +6351,8 @@ f() sync* {
|
| var yield = 1;
|
| }
|
| ''');
|
| - await assertErrors(
|
| - source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
|
| verify([source]);
|
| }
|
|
|
| @@ -6032,12 +6360,12 @@ f() sync* {
|
| String expr, bool resolved) async {
|
| Source source = addSource("const C = $expr;");
|
| if (resolved) {
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]);
|
| verify([source]);
|
| } else {
|
| - await assertErrors(
|
| - source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]);
|
| // no verify(), 'null x' is not resolved
|
| }
|
| reset();
|
| @@ -6050,7 +6378,8 @@ class A {
|
| final a;
|
| const A(bool p) : a = $expr;
|
| }''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL,
|
| StaticTypeWarningCode.NON_BOOL_OPERAND
|
| ]);
|
| @@ -6064,7 +6393,8 @@ class A {
|
| final a;
|
| const A(int p) : a = $expr;
|
| }''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.CONST_EVAL_TYPE_INT,
|
| StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
| ]);
|
| @@ -6078,7 +6408,8 @@ class A {
|
| final a;
|
| const A(num p) : a = $expr;
|
| }''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CompileTimeErrorCode.CONST_EVAL_TYPE_NUM,
|
| StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
| ]);
|
| @@ -6092,7 +6423,8 @@ class A {
|
| class A {
|
| operator $name($parameters) {}
|
| }''');
|
| - await assertErrors(
|
| + await computeAnalysisResult(source);
|
| + assertErrors(
|
| source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]);
|
| verify([source]);
|
| reset();
|
|
|