| Index: pkg/analyzer/test/generated/checked_mode_compile_time_error_code_test.dart
|
| diff --git a/pkg/analyzer/test/generated/checked_mode_compile_time_error_code_test.dart b/pkg/analyzer/test/generated/checked_mode_compile_time_error_code_test.dart
|
| index a580660e1fff5859fdb8726c01aea74c8b00cd48..6a7256c451b6760aa28d40c98fe80282fe68c1bd 100644
|
| --- a/pkg/analyzer/test/generated/checked_mode_compile_time_error_code_test.dart
|
| +++ b/pkg/analyzer/test/generated/checked_mode_compile_time_error_code_test.dart
|
| @@ -34,7 +34,8 @@ class C {
|
| const C(this.a);
|
| }
|
| var v = const C(const B());''');
|
| - await assertNoErrors(source);
|
| + await computeAnalysisResult(source);
|
| + assertNoErrors(source);
|
| verify([source]);
|
| }
|
|
|
| @@ -47,7 +48,8 @@ class A {
|
| const A(String this.x);
|
| }
|
| var v = const A(null);''');
|
| - await assertErrors(source, [StaticWarningCode.UNDEFINED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [StaticWarningCode.UNDEFINED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -65,7 +67,8 @@ class C {
|
| const C(this.a);
|
| }
|
| var v = const C(const B());''');
|
| - await assertNoErrors(source);
|
| + await computeAnalysisResult(source);
|
| + assertNoErrors(source);
|
| verify([source]);
|
| }
|
|
|
| @@ -76,7 +79,8 @@ class A {
|
| const A(List<int> x);
|
| }
|
| var x = const A(const [1, 2, 3]);''');
|
| - await assertNoErrors(source);
|
| + await computeAnalysisResult(source);
|
| + assertNoErrors(source);
|
| verify([source]);
|
| }
|
|
|
| @@ -87,7 +91,8 @@ class A {
|
| const A(List<num> x);
|
| }
|
| var x = const A(const <int>[1, 2, 3]);''');
|
| - await assertNoErrors(source);
|
| + await computeAnalysisResult(source);
|
| + assertNoErrors(source);
|
| verify([source]);
|
| }
|
|
|
| @@ -99,7 +104,8 @@ class A {
|
| const A(Map<int, int> x);
|
| }
|
| var x = const A(const {1: 2});''');
|
| - await assertNoErrors(source);
|
| + await computeAnalysisResult(source);
|
| + assertNoErrors(source);
|
| verify([source]);
|
| }
|
|
|
| @@ -111,7 +117,8 @@ class A {
|
| const A(Map<num, int> x);
|
| }
|
| var x = const A(const <int, int>{1: 2});''');
|
| - await assertNoErrors(source);
|
| + await computeAnalysisResult(source);
|
| + assertNoErrors(source);
|
| verify([source]);
|
| }
|
|
|
| @@ -123,7 +130,8 @@ class A {
|
| const A(Map<int, num> x);
|
| }
|
| var x = const A(const <int, int>{1: 2});''');
|
| - await assertNoErrors(source);
|
| + await computeAnalysisResult(source);
|
| + assertNoErrors(source);
|
| verify([source]);
|
| }
|
|
|
| @@ -136,7 +144,8 @@ class A {
|
| const A(this.x);
|
| }
|
| var v = const A(5);''');
|
| - await assertNoErrors(source);
|
| + await computeAnalysisResult(source);
|
| + assertNoErrors(source);
|
| verify([source]);
|
| }
|
|
|
| @@ -148,7 +157,8 @@ class A {
|
| const A(this.x);
|
| }
|
| var v = const A(null);''');
|
| - await assertNoErrors(source);
|
| + await computeAnalysisResult(source);
|
| + assertNoErrors(source);
|
| verify([source]);
|
| }
|
|
|
| @@ -163,7 +173,8 @@ class A {
|
| }
|
| foo(x) => 1;
|
| var v = const A(foo);''');
|
| - await assertNoErrors(source);
|
| + await computeAnalysisResult(source);
|
| + assertNoErrors(source);
|
| verify([source]);
|
| }
|
|
|
| @@ -176,7 +187,8 @@ class A<T> {
|
| const A(this.x);
|
| }
|
| var v = const A<int>(3);''');
|
| - await assertNoErrors(source);
|
| + await computeAnalysisResult(source);
|
| + assertNoErrors(source);
|
| verify([source]);
|
| }
|
|
|
| @@ -187,7 +199,8 @@ class A {
|
| const A(this.x);
|
| }
|
| var v = const A('foo');''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH,
|
| StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
| ]);
|
| @@ -210,7 +223,8 @@ class C {
|
| const C(this.b);
|
| }
|
| var v = const C(const A());''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH
|
| ]);
|
| verify([source]);
|
| @@ -223,7 +237,8 @@ class A {
|
| const A(String this.x);
|
| }
|
| var v = const A('foo');''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH,
|
| StaticWarningCode.FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE
|
| ]);
|
| @@ -237,7 +252,8 @@ class A {
|
| const A(String this.x);
|
| }
|
| var v = const A('foo');''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH,
|
| StaticWarningCode.UNDEFINED_CLASS
|
| ]);
|
| @@ -258,7 +274,8 @@ class C {
|
| const C(this.b);
|
| }
|
| var v = const C(const A());''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH
|
| ]);
|
| verify([source]);
|
| @@ -271,7 +288,8 @@ class A {
|
| const A(List<int> x);
|
| }
|
| var x = const A(const <num>[1, 2, 3]);''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH
|
| ]);
|
| verify([source]);
|
| @@ -285,7 +303,8 @@ class A {
|
| const A(Map<int, int> x);
|
| }
|
| var x = const A(const <num, int>{1: 2});''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH
|
| ]);
|
| verify([source]);
|
| @@ -299,7 +318,8 @@ class A {
|
| const A(Map<int, int> x);
|
| }
|
| var x = const A(const <int, num>{1: 2});''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH
|
| ]);
|
| verify([source]);
|
| @@ -312,7 +332,8 @@ class A {
|
| const A([this.x = 'foo']);
|
| }
|
| var v = const A();''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH,
|
| StaticTypeWarningCode.INVALID_ASSIGNMENT
|
| ]);
|
| @@ -330,7 +351,8 @@ class A {
|
| }
|
| int foo(String x) => 1;
|
| var v = const A(foo);''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH,
|
| StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
| ]);
|
| @@ -343,7 +365,8 @@ class A {
|
| final int x;
|
| const A() : x = '';
|
| }''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CheckedModeCompileTimeErrorCode.CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE,
|
| StaticWarningCode.FIELD_INITIALIZER_NOT_ASSIGNABLE
|
| ]);
|
| @@ -357,7 +380,8 @@ class A {
|
| final int y;
|
| }
|
| var v = const A('foo');''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH
|
| ]);
|
| verify([source]);
|
| @@ -372,7 +396,8 @@ class C<T> {
|
| const int y = 1;
|
| var v = const C<String>();
|
| ''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH,
|
| StaticTypeWarningCode.INVALID_ASSIGNMENT
|
| ]);
|
| @@ -386,7 +411,8 @@ class A {
|
| final Unresolved y;
|
| }
|
| var v = const A('foo');''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH,
|
| StaticWarningCode.UNDEFINED_CLASS
|
| ]);
|
| @@ -402,7 +428,8 @@ class C<T> {
|
| const int y = 1;
|
| var v = const C<int>();
|
| ''');
|
| - await assertErrors(source, [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
|
| verify([source]);
|
| }
|
|
|
| @@ -413,7 +440,8 @@ class A {
|
| final int y;
|
| }
|
| var v = const A(null);''');
|
| - await assertNoErrors(source);
|
| + await computeAnalysisResult(source);
|
| + assertNoErrors(source);
|
| verify([source]);
|
| }
|
|
|
| @@ -426,13 +454,15 @@ class A {
|
| final Unresolved y;
|
| }
|
| var v = const A(null);''');
|
| - await assertErrors(source, [StaticWarningCode.UNDEFINED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [StaticWarningCode.UNDEFINED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| test_listElementTypeNotAssignable() async {
|
| Source source = addSource("var v = const <String> [42];");
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CheckedModeCompileTimeErrorCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE,
|
| StaticWarningCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE
|
| ]);
|
| @@ -441,7 +471,8 @@ var v = const A(null);''');
|
|
|
| test_mapKeyTypeNotAssignable() async {
|
| Source source = addSource("var v = const <String, int > {1 : 2};");
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CheckedModeCompileTimeErrorCode.MAP_KEY_TYPE_NOT_ASSIGNABLE,
|
| StaticWarningCode.MAP_KEY_TYPE_NOT_ASSIGNABLE
|
| ]);
|
| @@ -450,7 +481,8 @@ var v = const A(null);''');
|
|
|
| test_mapValueTypeNotAssignable() async {
|
| Source source = addSource("var v = const <String, String> {'a' : 2};");
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CheckedModeCompileTimeErrorCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE,
|
| StaticWarningCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE
|
| ]);
|
| @@ -464,7 +496,8 @@ class A {
|
| const A(int x);
|
| }
|
| var v = const A(null);''');
|
| - await assertNoErrors(source);
|
| + await computeAnalysisResult(source);
|
| + assertNoErrors(source);
|
| verify([source]);
|
| }
|
|
|
| @@ -474,7 +507,8 @@ class A<T> {
|
| const A(T x);
|
| }
|
| var v = const A<int>(3);''');
|
| - await assertNoErrors(source);
|
| + await computeAnalysisResult(source);
|
| + assertNoErrors(source);
|
| verify([source]);
|
| }
|
|
|
| @@ -486,7 +520,8 @@ class A {
|
| const A(Unresolved x);
|
| }
|
| var v = const A(null);''');
|
| - await assertErrors(source, [StaticWarningCode.UNDEFINED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [StaticWarningCode.UNDEFINED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| @@ -496,7 +531,8 @@ class A {
|
| const A(int x);
|
| }
|
| var v = const A('foo');''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH,
|
| StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
| ]);
|
| @@ -509,7 +545,8 @@ class A<T> {
|
| const A(T x);
|
| }
|
| var v = const A<int>('foo');''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH,
|
| StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
| ]);
|
| @@ -522,7 +559,8 @@ class A {
|
| const A(Unresolved x);
|
| }
|
| var v = const A('foo');''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH,
|
| StaticWarningCode.UNDEFINED_CLASS
|
| ]);
|
| @@ -536,7 +574,8 @@ class A {
|
| const A.a2(String x);
|
| }
|
| var v = const A.a1(0);''');
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH
|
| ]);
|
| verify([source]);
|
| @@ -544,7 +583,8 @@ var v = const A.a1(0);''');
|
|
|
| test_topLevelVarAssignable_null() async {
|
| Source source = addSource("const int x = null;");
|
| - await assertNoErrors(source);
|
| + await computeAnalysisResult(source);
|
| + assertNoErrors(source);
|
| verify([source]);
|
| }
|
|
|
| @@ -552,13 +592,15 @@ var v = const A.a1(0);''');
|
| // Null always passes runtime type checks, even when the type is
|
| // unresolved.
|
| Source source = addSource("const Unresolved x = null;");
|
| - await assertErrors(source, [StaticWarningCode.UNDEFINED_CLASS]);
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [StaticWarningCode.UNDEFINED_CLASS]);
|
| verify([source]);
|
| }
|
|
|
| test_topLevelVarNotAssignable() async {
|
| Source source = addSource("const int x = 'foo';");
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CheckedModeCompileTimeErrorCode.VARIABLE_TYPE_MISMATCH,
|
| StaticTypeWarningCode.INVALID_ASSIGNMENT
|
| ]);
|
| @@ -567,7 +609,8 @@ var v = const A.a1(0);''');
|
|
|
| test_topLevelVarNotAssignable_undefined() async {
|
| Source source = addSource("const Unresolved x = 'foo';");
|
| - await assertErrors(source, [
|
| + await computeAnalysisResult(source);
|
| + assertErrors(source, [
|
| CheckedModeCompileTimeErrorCode.VARIABLE_TYPE_MISMATCH,
|
| StaticWarningCode.UNDEFINED_CLASS
|
| ]);
|
|
|