diff --git a/pkg/analysis_server/lib/src/edit/fix/fix_error_task.dart b/pkg/analysis_server/lib/src/edit/fix/fix_error_task.dart
index 7fc3e1ef8e2..d15e724011f 100644
--- a/pkg/analysis_server/lib/src/edit/fix/fix_error_task.dart
+++ b/pkg/analysis_server/lib/src/edit/fix/fix_error_task.dart
@@ -65,7 +65,7 @@ class FixErrorTask {
static void fixNamedConstructorTypeArgs(DartFixRegistrar registrar,
DartFixListener listener, EditDartfixParams params) {
registrar.registerErrorTask(
- StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
+ CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
FixErrorTask(listener));
}
}
diff --git a/pkg/analysis_server/lib/src/services/correction/fix.dart b/pkg/analysis_server/lib/src/services/correction/fix.dart
index b9c34974e4c..332b3f585f3 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix.dart
@@ -14,8 +14,11 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
/// Return true if this [errorCode] is likely to have a fix associated with it.
bool hasFix(ErrorCode errorCode) =>
- errorCode == CompileTimeErrorCode.UNDEFINED_CLASS_BOOLEAN ||
+ errorCode == CompileTimeErrorCode.CAST_TO_NON_TYPE ||
errorCode == CompileTimeErrorCode.CONCRETE_CLASS_WITH_ABSTRACT_MEMBER ||
+ errorCode == CompileTimeErrorCode.ILLEGAL_ASYNC_RETURN_TYPE ||
+ errorCode == CompileTimeErrorCode.INSTANCE_ACCESS_TO_STATIC_MEMBER ||
+ errorCode == CompileTimeErrorCode.INVOCATION_OF_NON_FUNCTION ||
errorCode == CompileTimeErrorCode.NEW_WITH_UNDEFINED_CONSTRUCTOR ||
errorCode ==
CompileTimeErrorCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE ||
@@ -29,7 +32,7 @@ bool hasFix(ErrorCode errorCode) =>
errorCode ==
CompileTimeErrorCode
.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS ||
- errorCode == CompileTimeErrorCode.CAST_TO_NON_TYPE ||
+ errorCode == CompileTimeErrorCode.NON_TYPE_AS_TYPE_ARGUMENT ||
errorCode == CompileTimeErrorCode.TYPE_TEST_WITH_UNDEFINED_NAME ||
errorCode == CompileTimeErrorCode.FINAL_NOT_INITIALIZED ||
errorCode == CompileTimeErrorCode.FINAL_NOT_INITIALIZED_CONSTRUCTOR_1 ||
@@ -44,8 +47,13 @@ bool hasFix(ErrorCode errorCode) =>
errorCode == CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT ||
errorCode == CompileTimeErrorCode.PART_OF_NON_PART ||
errorCode == CompileTimeErrorCode.UNDEFINED_ANNOTATION ||
+ errorCode == CompileTimeErrorCode.UNDEFINED_CLASS_BOOLEAN ||
errorCode ==
CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT ||
+ errorCode == CompileTimeErrorCode.UNDEFINED_FUNCTION ||
+ errorCode == CompileTimeErrorCode.UNDEFINED_GETTER ||
+ errorCode == CompileTimeErrorCode.UNDEFINED_METHOD ||
+ errorCode == CompileTimeErrorCode.UNDEFINED_SETTER ||
errorCode == CompileTimeErrorCode.URI_DOES_NOT_EXIST ||
errorCode == CompileTimeErrorCode.URI_HAS_NOT_BEEN_GENERATED ||
errorCode == HintCode.CAN_BE_NULL_AFTER_NULL_AWARE ||
@@ -60,14 +68,6 @@ bool hasFix(ErrorCode errorCode) =>
errorCode == ParserErrorCode.EXPECTED_TOKEN ||
errorCode == ParserErrorCode.GETTER_WITH_PARAMETERS ||
errorCode == ParserErrorCode.VAR_AS_TYPE_NAME ||
- errorCode == StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE ||
- errorCode == StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER ||
- errorCode == StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION ||
- errorCode == StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT ||
- errorCode == StaticTypeWarningCode.UNDEFINED_FUNCTION ||
- errorCode == StaticTypeWarningCode.UNDEFINED_GETTER ||
- errorCode == StaticTypeWarningCode.UNDEFINED_METHOD ||
- errorCode == StaticTypeWarningCode.UNDEFINED_SETTER ||
errorCode == CompileTimeErrorCode.UNDEFINED_NAMED_PARAMETER ||
(errorCode is LintCode &&
(errorCode.name == LintNames.always_require_non_null_named_parameters ||
diff --git a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
index 90f10f5d0c5..b971b294610 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -528,6 +528,9 @@ class FixProcessor extends BaseProcessor {
CompileTimeErrorCode.NON_TYPE_IN_CATCH_CLAUSE: [
ImportLibrary.forType,
],
+ CompileTimeErrorCode.NON_TYPE_AS_TYPE_ARGUMENT: [
+ ImportLibrary.forType,
+ ],
CompileTimeErrorCode.NOT_A_TYPE: [
ImportLibrary.forType,
],
@@ -544,12 +547,25 @@ class FixProcessor extends BaseProcessor {
CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT: [
AddSuperConstructorInvocation.newInstance,
],
+ CompileTimeErrorCode.UNDEFINED_FUNCTION: [
+ ImportLibrary.forExtension,
+ ImportLibrary.forFunction,
+ ImportLibrary.forType,
+ ],
+ CompileTimeErrorCode.UNDEFINED_GETTER: [
+ ImportLibrary.forTopLevelVariable,
+ ImportLibrary.forType,
+ ],
CompileTimeErrorCode.UNDEFINED_IDENTIFIER: [
ImportLibrary.forExtension,
ImportLibrary.forFunction,
ImportLibrary.forTopLevelVariable,
ImportLibrary.forType,
],
+ CompileTimeErrorCode.UNDEFINED_METHOD: [
+ ImportLibrary.forFunction,
+ ImportLibrary.forType,
+ ],
CompileTimeErrorCode.UNDEFINED_NAMED_PARAMETER: [
ChangeArgumentName.newInstance,
],
@@ -562,22 +578,6 @@ class FixProcessor extends BaseProcessor {
HintCode.SDK_VERSION_ASYNC_EXPORTED_FROM_CORE: [
ImportLibrary.dartAsync,
],
- StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT: [
- ImportLibrary.forType,
- ],
- StaticTypeWarningCode.UNDEFINED_FUNCTION: [
- ImportLibrary.forExtension,
- ImportLibrary.forFunction,
- ImportLibrary.forType,
- ],
- StaticTypeWarningCode.UNDEFINED_GETTER: [
- ImportLibrary.forTopLevelVariable,
- ImportLibrary.forType,
- ],
- StaticTypeWarningCode.UNDEFINED_METHOD: [
- ImportLibrary.forFunction,
- ImportLibrary.forType,
- ],
};
/// A map from error codes to a list of generators used to create the
@@ -651,6 +651,9 @@ class FixProcessor extends BaseProcessor {
CompileTimeErrorCode.FINAL_NOT_INITIALIZED_CONSTRUCTOR_3_PLUS: [
AddFieldFormalParameters.newInstance,
],
+ CompileTimeErrorCode.ILLEGAL_ASYNC_RETURN_TYPE: [
+ ReplaceReturnTypeFuture.newInstance,
+ ],
CompileTimeErrorCode.IMPLEMENTS_NON_CLASS: [
ChangeTo.classOrMixin,
CreateClass.newInstance,
@@ -658,6 +661,9 @@ class FixProcessor extends BaseProcessor {
CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD: [
CreateField.newInstance,
],
+ CompileTimeErrorCode.INSTANCE_ACCESS_TO_STATIC_MEMBER: [
+ ChangeToStaticAccess.newInstance,
+ ],
CompileTimeErrorCode.INTEGER_LITERAL_IMPRECISE_AS_DOUBLE: [
ChangeToNearestPreciseValue.newInstance,
],
@@ -665,6 +671,13 @@ class FixProcessor extends BaseProcessor {
ChangeTo.annotation,
CreateClass.newInstance,
],
+ CompileTimeErrorCode.INVALID_ASSIGNMENT: [
+ AddExplicitCast.newInstance,
+ ChangeTypeAnnotation.newInstance,
+ ],
+ CompileTimeErrorCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION: [
+ RemoveParenthesesInGetterInvocation.newInstance,
+ ],
CompileTimeErrorCode.MISSING_DEFAULT_VALUE_FOR_PARAMETER: [
AddRequiredKeyword.newInstance,
],
@@ -707,6 +720,13 @@ class FixProcessor extends BaseProcessor {
CreateNoSuchMethod.newInstance,
MakeClassAbstract.newInstance,
],
+ CompileTimeErrorCode.NON_BOOL_CONDITION: [
+ AddNeNull.newInstance,
+ ],
+ CompileTimeErrorCode.NON_TYPE_AS_TYPE_ARGUMENT: [
+ CreateClass.newInstance,
+ CreateMixin.newInstance,
+ ],
CompileTimeErrorCode.NOT_A_TYPE: [
ChangeTo.classOrMixin,
CreateClass.newInstance,
@@ -756,6 +776,20 @@ class FixProcessor extends BaseProcessor {
ChangeTo.getterOrSetter,
CreateSetter.newInstance,
],
+ CompileTimeErrorCode.UNDEFINED_FUNCTION: [
+ ChangeTo.function,
+ CreateClass.newInstance,
+ CreateFunction.newInstance,
+ ],
+ CompileTimeErrorCode.UNDEFINED_GETTER: [
+ ChangeTo.getterOrSetter,
+ CreateClass.newInstance,
+ CreateField.newInstance,
+ CreateGetter.newInstance,
+ CreateLocalVariable.newInstance,
+ CreateMethodOrFunction.newInstance,
+ CreateMixin.newInstance,
+ ],
CompileTimeErrorCode.UNDEFINED_IDENTIFIER: [
ChangeTo.getterOrSetter,
CreateClass.newInstance,
@@ -769,11 +803,28 @@ class FixProcessor extends BaseProcessor {
CompileTimeErrorCode.UNDEFINED_IDENTIFIER_AWAIT: [
AddAsync.newInstance,
],
+ CompileTimeErrorCode.UNDEFINED_METHOD: [
+ ChangeTo.method,
+ CreateClass.newInstance,
+ CreateFunction.newInstance,
+ CreateMethod.method,
+ ],
CompileTimeErrorCode.UNDEFINED_NAMED_PARAMETER: [
AddMissingParameterNamed.newInstance,
ConvertFlutterChild.newInstance,
ConvertFlutterChildren.newInstance,
],
+ CompileTimeErrorCode.UNDEFINED_SETTER: [
+ ChangeTo.getterOrSetter,
+ CreateField.newInstance,
+ CreateSetter.newInstance,
+ ],
+ CompileTimeErrorCode.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER: [
+ // TODO(brianwilkerson) Consider adding fixes to create a field, getter,
+ // method or setter. The existing _addFix methods would need to be
+ // updated so that only the appropriate subset is generated.
+ QualifyReference.newInstance,
+ ],
CompileTimeErrorCode
.UNQUALIFIED_REFERENCE_TO_STATIC_MEMBER_OF_EXTENDED_TYPE: [
// TODO(brianwilkerson) Consider adding fixes to create a field, getter,
@@ -784,6 +835,10 @@ class FixProcessor extends BaseProcessor {
CompileTimeErrorCode.URI_DOES_NOT_EXIST: [
CreateFile.newInstance,
],
+ CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR: [
+ MoveTypeArgumentsToClass.newInstance,
+ RemoveTypeArguments.newInstance,
+ ],
HintCode.CAN_BE_NULL_AFTER_NULL_AWARE: [
ReplaceWithNullAware.newInstance,
@@ -943,61 +998,6 @@ class FixProcessor extends BaseProcessor {
ParserErrorCode.VAR_AS_TYPE_NAME: [
ReplaceVarWithDynamic.newInstance,
],
- StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE: [
- ReplaceReturnTypeFuture.newInstance,
- ],
- StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER: [
- ChangeToStaticAccess.newInstance,
- ],
- StaticTypeWarningCode.INVALID_ASSIGNMENT: [
- AddExplicitCast.newInstance,
- ChangeTypeAnnotation.newInstance,
- ],
- StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION: [
- RemoveParenthesesInGetterInvocation.newInstance,
- ],
- StaticTypeWarningCode.NON_BOOL_CONDITION: [
- AddNeNull.newInstance,
- ],
- StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT: [
- CreateClass.newInstance,
- CreateMixin.newInstance,
- ],
- StaticTypeWarningCode.UNDEFINED_FUNCTION: [
- ChangeTo.function,
- CreateClass.newInstance,
- CreateFunction.newInstance,
- ],
- StaticTypeWarningCode.UNDEFINED_GETTER: [
- ChangeTo.getterOrSetter,
- CreateClass.newInstance,
- CreateField.newInstance,
- CreateGetter.newInstance,
- CreateLocalVariable.newInstance,
- CreateMethodOrFunction.newInstance,
- CreateMixin.newInstance,
- ],
- StaticTypeWarningCode.UNDEFINED_METHOD: [
- ChangeTo.method,
- CreateClass.newInstance,
- CreateFunction.newInstance,
- CreateMethod.method,
- ],
- StaticTypeWarningCode.UNDEFINED_SETTER: [
- ChangeTo.getterOrSetter,
- CreateField.newInstance,
- CreateSetter.newInstance,
- ],
- StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR: [
- MoveTypeArgumentsToClass.newInstance,
- RemoveTypeArguments.newInstance,
- ],
- StaticTypeWarningCode.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER: [
- // TODO(brianwilkerson) Consider adding fixes to create a field, getter,
- // method or setter. The existing _addFix methods would need to be
- // updated so that only the appropriate subset is generated.
- QualifyReference.newInstance,
- ],
StaticWarningCode.DEAD_NULL_AWARE_EXPRESSION: [
RemoveDeadIfNull.newInstance,
],
diff --git a/pkg/analysis_server/test/context_manager_test.dart b/pkg/analysis_server/test/context_manager_test.dart
index 51e813fffdf..59af0c157ff 100644
--- a/pkg/analysis_server/test/context_manager_test.dart
+++ b/pkg/analysis_server/test/context_manager_test.dart
@@ -1544,7 +1544,7 @@ abstract class ContextManagerTest with ResourceProviderMixin {
]);
AnalysisError invalid_assignment_error =
- AnalysisError(null, 0, 1, StaticTypeWarningCode.INVALID_ASSIGNMENT, [
+ AnalysisError(null, 0, 1, CompileTimeErrorCode.INVALID_ASSIGNMENT, [
['x'],
['y']
]);
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_explicit_cast_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_explicit_cast_test.dart
index 1f84c34f81a..cdcb95c7f5a 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_explicit_cast_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_explicit_cast_test.dart
@@ -64,7 +64,7 @@ f(A a) {
class A {}
class B {}
''');
- await assertHasFixAllFix(StaticTypeWarningCode.INVALID_ASSIGNMENT, '''
+ await assertHasFixAllFix(CompileTimeErrorCode.INVALID_ASSIGNMENT, '''
f(A a) {
B b, b2;
b = a as B;
@@ -106,7 +106,7 @@ f(List a) {
class A {}
class B {}
''');
- await assertHasFixAllFix(StaticTypeWarningCode.INVALID_ASSIGNMENT, '''
+ await assertHasFixAllFix(CompileTimeErrorCode.INVALID_ASSIGNMENT, '''
f(List a) {
List b, b2;
b = a.where((e) => e is B).cast().toList();
@@ -148,7 +148,7 @@ f(Map a) {
class A {}
class B {}
''');
- await assertHasFixAllFix(StaticTypeWarningCode.INVALID_ASSIGNMENT, '''
+ await assertHasFixAllFix(CompileTimeErrorCode.INVALID_ASSIGNMENT, '''
f(Map a) {
Map b, b2;
b = a.cast();
@@ -196,7 +196,7 @@ class A {
}
class B {}
''');
- await assertHasFixAllFix(StaticTypeWarningCode.INVALID_ASSIGNMENT, '''
+ await assertHasFixAllFix(CompileTimeErrorCode.INVALID_ASSIGNMENT, '''
f(A a) {
B b, b2;
b = (a..m()) as B;
@@ -240,7 +240,7 @@ f(Set a) {
class A {}
class B {}
''');
- await assertHasFixAllFix(StaticTypeWarningCode.INVALID_ASSIGNMENT, '''
+ await assertHasFixAllFix(CompileTimeErrorCode.INVALID_ASSIGNMENT, '''
f(Set a) {
Set b, b2;
b = a.cast();
@@ -291,7 +291,7 @@ f(A a) {
class A {}
class B {}
''');
- await assertHasFixAllFix(StaticTypeWarningCode.INVALID_ASSIGNMENT, '''
+ await assertHasFixAllFix(CompileTimeErrorCode.INVALID_ASSIGNMENT, '''
f(A a) {
B b = a as B;
B b2 = a as B;
@@ -329,7 +329,7 @@ f(List a) {
class A {}
class B {}
''');
- await assertHasFixAllFix(StaticTypeWarningCode.INVALID_ASSIGNMENT, '''
+ await assertHasFixAllFix(CompileTimeErrorCode.INVALID_ASSIGNMENT, '''
f(List a) {
List b = a.where((e) => e is B).cast().toList();
List b2 = a.where((e) => e is B).cast().toList();
@@ -367,7 +367,7 @@ f(Map a) {
class A {}
class B {}
''');
- await assertHasFixAllFix(StaticTypeWarningCode.INVALID_ASSIGNMENT, '''
+ await assertHasFixAllFix(CompileTimeErrorCode.INVALID_ASSIGNMENT, '''
f(Map a) {
Map b = a.cast();
Map b2 = a.cast();
@@ -411,7 +411,7 @@ class A {
}
class B {}
''');
- await assertHasFixAllFix(StaticTypeWarningCode.INVALID_ASSIGNMENT, '''
+ await assertHasFixAllFix(CompileTimeErrorCode.INVALID_ASSIGNMENT, '''
f(A a) {
B b = (a..m()) as B;
B b2 = (a..m()) as B;
@@ -451,7 +451,7 @@ f(Set a) {
class A {}
class B {}
''');
- await assertHasFixAllFix(StaticTypeWarningCode.INVALID_ASSIGNMENT, '''
+ await assertHasFixAllFix(CompileTimeErrorCode.INVALID_ASSIGNMENT, '''
f(Set a) {
Set b = a.cast();
Set b2 = a.cast();
@@ -469,7 +469,7 @@ void foo(int a) {
''');
await assertNoFix(
errorFilter: (e) {
- return e.errorCode == StaticTypeWarningCode.INVALID_ASSIGNMENT;
+ return e.errorCode == CompileTimeErrorCode.INVALID_ASSIGNMENT;
},
);
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_ne_null_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_ne_null_test.dart
index a844e27ed5d..657adccdb16 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_ne_null_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_ne_null_test.dart
@@ -48,7 +48,7 @@ main(String p, String q) {
}
}
''');
- await assertHasFixAllFix(StaticTypeWarningCode.NON_BOOL_CONDITION, '''
+ await assertHasFixAllFix(CompileTimeErrorCode.NON_BOOL_CONDITION, '''
main(String p, String q) {
if (p != null) {
print(p);
diff --git a/pkg/analysis_server/test/src/services/correction/fix/change_type_annotation_test.dart b/pkg/analysis_server/test/src/services/correction/fix/change_type_annotation_test.dart
index b9f2735b4ff..91c23218bb9 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/change_type_annotation_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/change_type_annotation_test.dart
@@ -78,7 +78,7 @@ int foo =
''');
await assertNoFix(
errorFilter: (e) {
- return e.errorCode == StaticTypeWarningCode.INVALID_ASSIGNMENT;
+ return e.errorCode == CompileTimeErrorCode.INVALID_ASSIGNMENT;
},
);
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_field_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_field_test.dart
index eec3b63da26..df32308f20a 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_field_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_field_test.dart
@@ -379,7 +379,7 @@ main(A a) {
}
''');
await assertNoFix(errorFilter: (e) {
- return e.errorCode == StaticTypeWarningCode.UNDEFINED_GETTER;
+ return e.errorCode == CompileTimeErrorCode.UNDEFINED_GETTER;
});
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_getter_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_getter_test.dart
index b3e1fe2a96a..c8797e34508 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_getter_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_getter_test.dart
@@ -322,7 +322,7 @@ main(A a) {
}
''');
await assertNoFix(errorFilter: (e) {
- return e.errorCode == StaticTypeWarningCode.UNDEFINED_GETTER;
+ return e.errorCode == CompileTimeErrorCode.UNDEFINED_GETTER;
});
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_setter_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_setter_test.dart
index 5dc1260178b..1a984bf4e20 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_setter_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_setter_test.dart
@@ -316,7 +316,7 @@ main(A a) {
}
''');
await assertNoFix(errorFilter: (e) {
- return e.errorCode == StaticTypeWarningCode.UNDEFINED_SETTER;
+ return e.errorCode == CompileTimeErrorCode.UNDEFINED_SETTER;
});
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/replace_return_type_future_test.dart b/pkg/analysis_server/test/src/services/correction/fix/replace_return_type_future_test.dart
index aa333d539c5..e40a0b27f1d 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/replace_return_type_future_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/replace_return_type_future_test.dart
@@ -29,7 +29,7 @@ var v;int main() async => 0;
import 'dart:async';
var v;Future main() async => 0;
''', errorFilter: (error) {
- return error.errorCode == StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE;
+ return error.errorCode == CompileTimeErrorCode.ILLEGAL_ASYNC_RETURN_TYPE;
});
}
@@ -53,7 +53,7 @@ import 'dart:async';
Future> main() async {
}
''', errorFilter: (error) {
- return error.errorCode == StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE;
+ return error.errorCode == CompileTimeErrorCode.ILLEGAL_ASYNC_RETURN_TYPE;
});
}
@@ -69,7 +69,7 @@ import 'dart:async';
Future> main() async {
}
''', errorFilter: (error) {
- return error.errorCode == StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE;
+ return error.errorCode == CompileTimeErrorCode.ILLEGAL_ASYNC_RETURN_TYPE;
});
}
@@ -84,7 +84,7 @@ import 'dart:async' as al;
al.Future main() async {
}
''', errorFilter: (error) {
- return error.errorCode == StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE;
+ return error.errorCode == CompileTimeErrorCode.ILLEGAL_ASYNC_RETURN_TYPE;
});
}
@@ -97,7 +97,7 @@ int main() async => 0;
import 'dart:async';
Future main() async => 0;
''', errorFilter: (error) {
- return error.errorCode == StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE;
+ return error.errorCode == CompileTimeErrorCode.ILLEGAL_ASYNC_RETURN_TYPE;
});
}
@@ -111,7 +111,7 @@ import 'dart:async';
Future main() async => 0;
''', errorFilter: (error) {
- return error.errorCode == StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE;
+ return error.errorCode == CompileTimeErrorCode.ILLEGAL_ASYNC_RETURN_TYPE;
});
}
@@ -128,7 +128,7 @@ import 'dart:async';
Future main() async {
}
''', errorFilter: (error) {
- return error.errorCode == StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE;
+ return error.errorCode == CompileTimeErrorCode.ILLEGAL_ASYNC_RETURN_TYPE;
});
}
diff --git a/pkg/analyzer/lib/error/error.dart b/pkg/analyzer/lib/error/error.dart
index e281f0d0814..c9eaa038c28 100644
--- a/pkg/analyzer/lib/error/error.dart
+++ b/pkg/analyzer/lib/error/error.dart
@@ -154,6 +154,9 @@ const List errorCodeValues = [
CompileTimeErrorCode.ENUM_CONSTANT_SAME_NAME_AS_ENCLOSING,
CompileTimeErrorCode.EQUAL_ELEMENTS_IN_CONST_SET,
CompileTimeErrorCode.EQUAL_KEYS_IN_CONST_MAP,
+ CompileTimeErrorCode.EXPECTED_ONE_LIST_TYPE_ARGUMENTS,
+ CompileTimeErrorCode.EXPECTED_ONE_SET_TYPE_ARGUMENTS,
+ CompileTimeErrorCode.EXPECTED_TWO_MAP_TYPE_ARGUMENTS,
CompileTimeErrorCode.EXPORT_INTERNAL_LIBRARY,
CompileTimeErrorCode.EXPORT_LEGACY_SYMBOL,
CompileTimeErrorCode.EXPORT_OF_NON_LIBRARY,
@@ -184,6 +187,8 @@ const List errorCodeValues = [
CompileTimeErrorCode.FINAL_NOT_INITIALIZED_CONSTRUCTOR_1,
CompileTimeErrorCode.FINAL_NOT_INITIALIZED_CONSTRUCTOR_2,
CompileTimeErrorCode.FINAL_NOT_INITIALIZED_CONSTRUCTOR_3_PLUS,
+ CompileTimeErrorCode.FOR_IN_OF_INVALID_ELEMENT_TYPE,
+ CompileTimeErrorCode.FOR_IN_OF_INVALID_TYPE,
CompileTimeErrorCode.FOR_IN_WITH_CONST_VARIABLE,
CompileTimeErrorCode.GENERIC_FUNCTION_TYPE_CANNOT_BE_BOUND,
CompileTimeErrorCode.GENERIC_FUNCTION_TYPE_CANNOT_BE_TYPE_ARGUMENT,
@@ -191,6 +196,7 @@ const List errorCodeValues = [
CompileTimeErrorCode.GETTER_NOT_SUBTYPE_SETTER_TYPES,
CompileTimeErrorCode.IF_ELEMENT_CONDITION_FROM_DEFERRED_LIBRARY,
CompileTimeErrorCode.ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE,
+ CompileTimeErrorCode.ILLEGAL_ASYNC_RETURN_TYPE,
CompileTimeErrorCode.ILLEGAL_SYNC_GENERATOR_RETURN_TYPE,
CompileTimeErrorCode.IMPLEMENTS_DEFERRED_CLASS,
CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS,
@@ -208,6 +214,7 @@ const List errorCodeValues = [
CompileTimeErrorCode.INITIALIZER_FOR_STATIC_FIELD,
CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD,
CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_STATIC_FIELD,
+ CompileTimeErrorCode.INSTANCE_ACCESS_TO_STATIC_MEMBER,
CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_FACTORY,
CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_STATIC,
CompileTimeErrorCode.INSTANTIATE_ABSTRACT_CLASS,
@@ -217,6 +224,7 @@ const List errorCodeValues = [
CompileTimeErrorCode.INVALID_ANNOTATION,
CompileTimeErrorCode.INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY,
CompileTimeErrorCode.INVALID_ANNOTATION_GETTER,
+ CompileTimeErrorCode.INVALID_ASSIGNMENT,
CompileTimeErrorCode.INVALID_CAST_FUNCTION,
CompileTimeErrorCode.INVALID_CAST_FUNCTION_EXPR,
CompileTimeErrorCode.INVALID_CAST_LITERAL,
@@ -242,6 +250,8 @@ const List errorCodeValues = [
CompileTimeErrorCode.INVALID_USE_OF_COVARIANT,
CompileTimeErrorCode.INVALID_USE_OF_NULL_VALUE,
CompileTimeErrorCode.INVOCATION_OF_EXTENSION_WITHOUT_CALL,
+ CompileTimeErrorCode.INVOCATION_OF_NON_FUNCTION,
+ CompileTimeErrorCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION,
CompileTimeErrorCode.LABEL_IN_OUTER_SCOPE,
CompileTimeErrorCode.LABEL_UNDEFINED,
CompileTimeErrorCode.LATE_FINAL_FIELD_WITH_CONST_CONSTRUCTOR,
@@ -288,6 +298,10 @@ const List errorCodeValues = [
CompileTimeErrorCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE,
CompileTimeErrorCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE,
CompileTimeErrorCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO,
+ CompileTimeErrorCode.NON_BOOL_CONDITION,
+ CompileTimeErrorCode.NON_BOOL_EXPRESSION,
+ CompileTimeErrorCode.NON_BOOL_NEGATION_EXPRESSION,
+ CompileTimeErrorCode.NON_BOOL_OPERAND,
CompileTimeErrorCode.NON_CONST_MAP_AS_EXPRESSION_STATEMENT,
CompileTimeErrorCode.NON_CONSTANT_ANNOTATION_CONSTRUCTOR,
CompileTimeErrorCode.NON_CONSTANT_CASE_EXPRESSION,
@@ -304,6 +318,7 @@ const List errorCodeValues = [
CompileTimeErrorCode.NON_CONSTANT_SET_ELEMENT,
CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR,
CompileTimeErrorCode.NON_SYNC_FACTORY,
+ CompileTimeErrorCode.NON_TYPE_AS_TYPE_ARGUMENT,
CompileTimeErrorCode.NON_TYPE_IN_CATCH_CLAUSE,
CompileTimeErrorCode.NON_VOID_RETURN_FOR_OPERATOR,
CompileTimeErrorCode.NON_VOID_RETURN_FOR_SETTER,
@@ -353,6 +368,10 @@ const List errorCodeValues = [
CompileTimeErrorCode.RETHROW_OUTSIDE_CATCH,
CompileTimeErrorCode.RETURN_IN_GENERATIVE_CONSTRUCTOR,
CompileTimeErrorCode.RETURN_IN_GENERATOR,
+ CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE,
+ CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_CONSTRUCTOR,
+ CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION,
+ CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_METHOD,
CompileTimeErrorCode.RETURN_WITHOUT_VALUE,
CompileTimeErrorCode.SET_ELEMENT_FROM_DEFERRED_LIBRARY,
CompileTimeErrorCode.SET_ELEMENT_TYPE_NOT_ASSIGNABLE,
@@ -371,6 +390,7 @@ const List errorCodeValues = [
CompileTimeErrorCode.TYPE_ANNOTATION_DEFERRED_CLASS,
CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS,
CompileTimeErrorCode.TYPE_PARAMETER_REFERENCED_BY_STATIC,
+ CompileTimeErrorCode.TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND,
CompileTimeErrorCode.TYPE_TEST_WITH_NON_TYPE,
CompileTimeErrorCode.TYPE_TEST_WITH_UNDEFINED_NAME,
CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE,
@@ -379,13 +399,25 @@ const List errorCodeValues = [
CompileTimeErrorCode.UNDEFINED_CLASS_BOOLEAN,
CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER,
CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT,
+ CompileTimeErrorCode.UNDEFINED_ENUM_CONSTANT,
CompileTimeErrorCode.UNDEFINED_EXTENSION_GETTER,
CompileTimeErrorCode.UNDEFINED_EXTENSION_METHOD,
CompileTimeErrorCode.UNDEFINED_EXTENSION_OPERATOR,
CompileTimeErrorCode.UNDEFINED_EXTENSION_SETTER,
+ CompileTimeErrorCode.UNDEFINED_FUNCTION,
+ CompileTimeErrorCode.UNDEFINED_GETTER,
CompileTimeErrorCode.UNDEFINED_IDENTIFIER,
CompileTimeErrorCode.UNDEFINED_IDENTIFIER_AWAIT,
+ CompileTimeErrorCode.UNDEFINED_METHOD,
CompileTimeErrorCode.UNDEFINED_NAMED_PARAMETER,
+ CompileTimeErrorCode.UNDEFINED_OPERATOR,
+ CompileTimeErrorCode.UNDEFINED_PREFIXED_NAME,
+ CompileTimeErrorCode.UNDEFINED_SETTER,
+ CompileTimeErrorCode.UNDEFINED_SUPER_GETTER,
+ CompileTimeErrorCode.UNDEFINED_SUPER_METHOD,
+ CompileTimeErrorCode.UNDEFINED_SUPER_OPERATOR,
+ CompileTimeErrorCode.UNDEFINED_SUPER_SETTER,
+ CompileTimeErrorCode.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER,
CompileTimeErrorCode.UNQUALIFIED_REFERENCE_TO_STATIC_MEMBER_OF_EXTENDED_TYPE,
CompileTimeErrorCode.URI_DOES_NOT_EXIST,
CompileTimeErrorCode.URI_HAS_NOT_BEEN_GENERATED,
@@ -395,10 +427,14 @@ const List errorCodeValues = [
CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR,
CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINUS,
CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER,
+ CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS,
+ CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
+ CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD,
CompileTimeErrorCode.WRONG_TYPE_PARAMETER_VARIANCE_IN_SUPERINTERFACE,
CompileTimeErrorCode.WRONG_TYPE_PARAMETER_VARIANCE_POSITION,
CompileTimeErrorCode.YIELD_EACH_IN_NON_GENERATOR,
CompileTimeErrorCode.YIELD_IN_NON_GENERATOR,
+ CompileTimeErrorCode.YIELD_OF_INVALID_TYPE,
FfiCode.ANNOTATION_ON_POINTER_FIELD,
FfiCode.EXTRA_ANNOTATION_ON_STRUCT_FIELD,
FfiCode.FIELD_IN_STRUCT_WITH_INITIALIZER,
@@ -748,42 +784,6 @@ const List errorCodeValues = [
ScannerErrorCode.UNSUPPORTED_OPERATOR,
ScannerErrorCode.UNTERMINATED_MULTI_LINE_COMMENT,
ScannerErrorCode.UNTERMINATED_STRING_LITERAL,
- StaticTypeWarningCode.EXPECTED_ONE_LIST_TYPE_ARGUMENTS,
- StaticTypeWarningCode.EXPECTED_ONE_SET_TYPE_ARGUMENTS,
- StaticTypeWarningCode.EXPECTED_TWO_MAP_TYPE_ARGUMENTS,
- StaticTypeWarningCode.FOR_IN_OF_INVALID_ELEMENT_TYPE,
- StaticTypeWarningCode.FOR_IN_OF_INVALID_TYPE,
- StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE,
- StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER,
- StaticTypeWarningCode.INVALID_ASSIGNMENT,
- StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION,
- StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION,
- StaticTypeWarningCode.NON_BOOL_CONDITION,
- StaticTypeWarningCode.NON_BOOL_EXPRESSION,
- StaticTypeWarningCode.NON_BOOL_NEGATION_EXPRESSION,
- StaticTypeWarningCode.NON_BOOL_OPERAND,
- StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT,
- StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE,
- StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_CONSTRUCTOR,
- StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION,
- StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_METHOD,
- StaticTypeWarningCode.TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND,
- StaticTypeWarningCode.UNDEFINED_ENUM_CONSTANT,
- StaticTypeWarningCode.UNDEFINED_FUNCTION,
- StaticTypeWarningCode.UNDEFINED_GETTER,
- StaticTypeWarningCode.UNDEFINED_METHOD,
- StaticTypeWarningCode.UNDEFINED_OPERATOR,
- StaticTypeWarningCode.UNDEFINED_PREFIXED_NAME,
- StaticTypeWarningCode.UNDEFINED_SETTER,
- StaticTypeWarningCode.UNDEFINED_SUPER_GETTER,
- StaticTypeWarningCode.UNDEFINED_SUPER_METHOD,
- StaticTypeWarningCode.UNDEFINED_SUPER_OPERATOR,
- StaticTypeWarningCode.UNDEFINED_SUPER_SETTER,
- StaticTypeWarningCode.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER,
- StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS,
- StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
- StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD,
- StaticTypeWarningCode.YIELD_OF_INVALID_TYPE,
StaticWarningCode.DEAD_NULL_AWARE_EXPRESSION,
StaticWarningCode.INVALID_NULL_AWARE_OPERATOR,
StaticWarningCode.INVALID_NULL_AWARE_OPERATOR_AFTER_SHORT_CIRCUIT,
diff --git a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
index b60196aa399..ea7d03be33b 100644
--- a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
@@ -442,8 +442,8 @@ class LibraryAnalyzer {
// non-internal code from importing internal code.
bool privileged = false;
- if (code == StaticTypeWarningCode.UNDEFINED_FUNCTION ||
- code == StaticTypeWarningCode.UNDEFINED_PREFIXED_NAME) {
+ if (code == CompileTimeErrorCode.UNDEFINED_FUNCTION ||
+ code == CompileTimeErrorCode.UNDEFINED_PREFIXED_NAME) {
// Special case a small number of errors in Flutter code which are
// ignored. The erroneous code is found in a conditionally imported
// library, which uses a special version of the "dart:ui" library
diff --git a/pkg/analyzer/lib/src/dart/constant/evaluation.dart b/pkg/analyzer/lib/src/dart/constant/evaluation.dart
index 2509b5fbc8e..aae5beab037 100644
--- a/pkg/analyzer/lib/src/dart/constant/evaluation.dart
+++ b/pkg/analyzer/lib/src/dart/constant/evaluation.dart
@@ -229,7 +229,7 @@ class ConstantEvaluationEngine {
if (dartObject != null && constant.isConst) {
if (!runtimeTypeMatch(dartObject, constant.type)) {
// TODO(brianwilkerson) This should not be reported if
- // StaticTypeWarningCode.INVALID_ASSIGNMENT has already been
+ // CompileTimeErrorCode.INVALID_ASSIGNMENT has already been
// reported (that is, if the static types are also wrong).
errorReporter.reportErrorForNode(
CheckedModeCompileTimeErrorCode.VARIABLE_TYPE_MISMATCH,
diff --git a/pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart
index 165da4320ec..e558b4d2b6a 100644
--- a/pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart
@@ -223,7 +223,7 @@ class AssignmentExpressionResolver {
node.staticElement = result.getter;
if (_shouldReportInvalidMember(staticType, result)) {
_errorReporter.reportErrorForToken(
- StaticTypeWarningCode.UNDEFINED_OPERATOR,
+ CompileTimeErrorCode.UNDEFINED_OPERATOR,
operator,
[methodName, staticType],
);
@@ -281,7 +281,7 @@ class AssignmentExpressionResolver {
var leftWriteType = _getStaticType2(node.leftHandSide);
if (!_typeSystem.isAssignableTo2(type, leftWriteType)) {
_resolver.errorReporter.reportErrorForNode(
- StaticTypeWarningCode.INVALID_ASSIGNMENT,
+ CompileTimeErrorCode.INVALID_ASSIGNMENT,
node.rightHandSide,
[type, leftWriteType],
);
diff --git a/pkg/analyzer/lib/src/dart/resolver/ast_rewrite.dart b/pkg/analyzer/lib/src/dart/resolver/ast_rewrite.dart
index aeff38bf3a9..b4bb472cd49 100644
--- a/pkg/analyzer/lib/src/dart/resolver/ast_rewrite.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/ast_rewrite.dart
@@ -65,7 +65,7 @@ class AstRewriter {
var typeArguments = node.typeArguments;
if (typeArguments != null) {
_errorReporter.reportErrorForNode(
- StaticTypeWarningCode
+ CompileTimeErrorCode
.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
typeArguments,
[element.name, constructorElement.name]);
@@ -122,7 +122,7 @@ class AstRewriter {
var typeArguments = node.typeArguments;
if (typeArguments != null) {
_errorReporter.reportErrorForNode(
- StaticTypeWarningCode
+ CompileTimeErrorCode
.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
typeArguments,
[element.name, constructorElement.name]);
diff --git a/pkg/analyzer/lib/src/dart/resolver/binary_expression_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/binary_expression_resolver.dart
index 818e4c5d0c8..8486729d887 100644
--- a/pkg/analyzer/lib/src/dart/resolver/binary_expression_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/binary_expression_resolver.dart
@@ -102,7 +102,7 @@ class BinaryExpressionResolver {
void _checkNonBoolOperand(Expression operand, String operator) {
_resolver.boolExpressionVerifier.checkForNonBoolExpression(
operand,
- errorCode: StaticTypeWarningCode.NON_BOOL_OPERAND,
+ errorCode: CompileTimeErrorCode.NON_BOOL_OPERAND,
arguments: [operator],
);
}
@@ -335,13 +335,13 @@ class BinaryExpressionResolver {
if (_shouldReportInvalidMember(leftType, result)) {
if (leftOperand is SuperExpression) {
_errorReporter.reportErrorForToken(
- StaticTypeWarningCode.UNDEFINED_SUPER_OPERATOR,
+ CompileTimeErrorCode.UNDEFINED_SUPER_OPERATOR,
node.operator,
[methodName, leftType],
);
} else {
_errorReporter.reportErrorForToken(
- StaticTypeWarningCode.UNDEFINED_OPERATOR,
+ CompileTimeErrorCode.UNDEFINED_OPERATOR,
node.operator,
[methodName, leftType],
);
diff --git a/pkg/analyzer/lib/src/dart/resolver/invocation_inference_helper.dart b/pkg/analyzer/lib/src/dart/resolver/invocation_inference_helper.dart
index cc18f5e892a..d6f416cbde3 100644
--- a/pkg/analyzer/lib/src/dart/resolver/invocation_inference_helper.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/invocation_inference_helper.dart
@@ -406,7 +406,7 @@ class InvocationInferenceHelper {
List typeArguments;
if (typeArgumentList.arguments.length != typeParameters.length) {
_errorReporter.reportErrorForNode(
- StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD,
+ CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD,
typeArgumentList,
[
rawType,
diff --git a/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart
index ceb24d4f9f0..3aa84e82003 100644
--- a/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart
@@ -190,13 +190,13 @@ class MethodInvocationResolver {
);
} else if (nullReceiver) {
_resolver.errorReporter.reportErrorForNode(
- StaticTypeWarningCode.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER,
+ CompileTimeErrorCode.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER,
nameNode,
[element.enclosingElement.displayName],
);
} else {
_resolver.errorReporter.reportErrorForNode(
- StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER,
+ CompileTimeErrorCode.INSTANCE_ACCESS_TO_STATIC_MEMBER,
nameNode,
[
nameNode.name,
@@ -210,7 +210,7 @@ class MethodInvocationResolver {
void _reportInvocationOfNonFunction(MethodInvocation node) {
_setDynamicResolution(node, setNameTypeToDynamic: false);
_resolver.errorReporter.reportErrorForNode(
- StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION,
+ CompileTimeErrorCode.INVOCATION_OF_NON_FUNCTION,
node.methodName,
[node.methodName.name],
);
@@ -245,7 +245,7 @@ class MethodInvocationResolver {
}
_resolver.errorReporter.reportErrorForNode(
- StaticTypeWarningCode.UNDEFINED_FUNCTION,
+ CompileTimeErrorCode.UNDEFINED_FUNCTION,
node.methodName,
[node.methodName.name],
);
@@ -255,7 +255,7 @@ class MethodInvocationResolver {
MethodInvocation node, String name, ClassElement typeReference) {
_setDynamicResolution(node);
_resolver.errorReporter.reportErrorForNode(
- StaticTypeWarningCode.UNDEFINED_METHOD,
+ CompileTimeErrorCode.UNDEFINED_METHOD,
node.methodName,
[name, typeReference.displayName],
);
@@ -609,7 +609,7 @@ class MethodInvocationResolver {
// Nothing help, there is no target at all.
_setDynamicResolution(node);
_resolver.errorReporter.reportErrorForNode(
- StaticTypeWarningCode.UNDEFINED_SUPER_METHOD,
+ CompileTimeErrorCode.UNDEFINED_SUPER_METHOD,
nameNode,
[name, enclosingClass.displayName]);
}
@@ -664,7 +664,7 @@ class MethodInvocationResolver {
if (!nameNode.isSynthetic) {
_resolver.errorReporter.reportErrorForNode(
- StaticTypeWarningCode.UNDEFINED_METHOD,
+ CompileTimeErrorCode.UNDEFINED_METHOD,
nameNode,
[name, receiverClassName],
);
diff --git a/pkg/analyzer/lib/src/dart/resolver/postfix_expression_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/postfix_expression_resolver.dart
index 43b20e78920..e3f3cc0b092 100644
--- a/pkg/analyzer/lib/src/dart/resolver/postfix_expression_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/postfix_expression_resolver.dart
@@ -73,7 +73,7 @@ class PostfixExpressionResolver {
var operandWriteType = _getWriteType(operand);
if (!_typeSystem.isAssignableTo2(type, operandWriteType)) {
_resolver.errorReporter.reportErrorForNode(
- StaticTypeWarningCode.INVALID_ASSIGNMENT,
+ CompileTimeErrorCode.INVALID_ASSIGNMENT,
node,
[type, operandWriteType],
);
@@ -149,13 +149,13 @@ class PostfixExpressionResolver {
if (_shouldReportInvalidMember(receiverType, result)) {
if (operand is SuperExpression) {
_errorReporter.reportErrorForToken(
- StaticTypeWarningCode.UNDEFINED_SUPER_OPERATOR,
+ CompileTimeErrorCode.UNDEFINED_SUPER_OPERATOR,
node.operator,
[methodName, receiverType],
);
} else {
_errorReporter.reportErrorForToken(
- StaticTypeWarningCode.UNDEFINED_OPERATOR,
+ CompileTimeErrorCode.UNDEFINED_OPERATOR,
node.operator,
[methodName, receiverType],
);
diff --git a/pkg/analyzer/lib/src/dart/resolver/prefix_expression_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/prefix_expression_resolver.dart
index beeb19aa74f..8a273347ec1 100644
--- a/pkg/analyzer/lib/src/dart/resolver/prefix_expression_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/prefix_expression_resolver.dart
@@ -73,7 +73,7 @@ class PrefixExpressionResolver {
var operandWriteType = _getStaticType(operand);
if (!_typeSystem.isAssignableTo2(type, operandWriteType)) {
_resolver.errorReporter.reportErrorForNode(
- StaticTypeWarningCode.INVALID_ASSIGNMENT,
+ CompileTimeErrorCode.INVALID_ASSIGNMENT,
node,
[type, operandWriteType],
);
@@ -205,13 +205,13 @@ class PrefixExpressionResolver {
if (_shouldReportInvalidMember(staticType, result)) {
if (operand is SuperExpression) {
_errorReporter.reportErrorForToken(
- StaticTypeWarningCode.UNDEFINED_SUPER_OPERATOR,
+ CompileTimeErrorCode.UNDEFINED_SUPER_OPERATOR,
operator,
[methodName, staticType],
);
} else {
_errorReporter.reportErrorForToken(
- StaticTypeWarningCode.UNDEFINED_OPERATOR,
+ CompileTimeErrorCode.UNDEFINED_OPERATOR,
operator,
[methodName, staticType],
);
diff --git a/pkg/analyzer/lib/src/dart/resolver/type_name_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/type_name_resolver.dart
index b6a88efff90..6fb94d6fc42 100644
--- a/pkg/analyzer/lib/src/dart/resolver/type_name_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/type_name_resolver.dart
@@ -122,7 +122,7 @@ class TypeNameResolver {
if (argumentCount != parameterCount) {
errorReporter.reportErrorForNode(
- StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS,
+ CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS,
node,
[node.name.name, parameterCount, argumentCount],
);
@@ -333,7 +333,7 @@ class TypeNameResolver {
var typeArguments = node.typeArguments;
if (typeArguments != null) {
errorReporter.reportErrorForNode(
- StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
+ CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
typeArguments,
[classIdentifier.name, constructorIdentifier.name],
);
@@ -454,7 +454,7 @@ class _ErrorHelper {
if (_isTypeInTypeArgumentList(node)) {
errorReporter.reportErrorForNode(
- StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT,
+ CompileTimeErrorCode.NON_TYPE_AS_TYPE_ARGUMENT,
identifier,
[identifier.name],
);
diff --git a/pkg/analyzer/lib/src/dart/resolver/yield_statement_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/yield_statement_resolver.dart
index f12a3d24f9a..e79edc9f7e3 100644
--- a/pkg/analyzer/lib/src/dart/resolver/yield_statement_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/yield_statement_resolver.dart
@@ -87,7 +87,7 @@ class YieldStatementResolver {
if (declaredReturnType != null) {
if (!_typeSystem.isAssignableTo2(impliedReturnType, declaredReturnType)) {
_errorReporter.reportErrorForNode(
- StaticTypeWarningCode.YIELD_OF_INVALID_TYPE,
+ CompileTimeErrorCode.YIELD_OF_INVALID_TYPE,
expression,
[impliedReturnType, declaredReturnType],
);
@@ -108,7 +108,7 @@ class YieldStatementResolver {
if (!_typeSystem.isAssignableTo2(impliedReturnType, requiredReturnType)) {
_errorReporter.reportErrorForNode(
- StaticTypeWarningCode.YIELD_OF_INVALID_TYPE,
+ CompileTimeErrorCode.YIELD_OF_INVALID_TYPE,
expression,
[impliedReturnType, requiredReturnType],
);
diff --git a/pkg/analyzer/lib/src/error/bool_expression_verifier.dart b/pkg/analyzer/lib/src/error/bool_expression_verifier.dart
index cf46b927a08..05eb039b6cb 100644
--- a/pkg/analyzer/lib/src/error/bool_expression_verifier.dart
+++ b/pkg/analyzer/lib/src/error/bool_expression_verifier.dart
@@ -35,11 +35,11 @@ class BoolExpressionVerifier {
/// Check to ensure that the [condition] is of type bool, are. Otherwise an
/// error is reported on the expression.
///
- /// See [StaticTypeWarningCode.NON_BOOL_CONDITION].
+ /// See [CompileTimeErrorCode.NON_BOOL_CONDITION].
void checkForNonBoolCondition(Expression condition) {
checkForNonBoolExpression(
condition,
- errorCode: StaticTypeWarningCode.NON_BOOL_CONDITION,
+ errorCode: CompileTimeErrorCode.NON_BOOL_CONDITION,
);
}
@@ -62,7 +62,7 @@ class BoolExpressionVerifier {
void checkForNonBoolNegationExpression(Expression expression) {
checkForNonBoolExpression(
expression,
- errorCode: StaticTypeWarningCode.NON_BOOL_NEGATION_EXPRESSION,
+ errorCode: CompileTimeErrorCode.NON_BOOL_NEGATION_EXPRESSION,
);
}
diff --git a/pkg/analyzer/lib/src/error/codes.dart b/pkg/analyzer/lib/src/error/codes.dart
index bc933063877..4a2f9c41a4e 100644
--- a/pkg/analyzer/lib/src/error/codes.dart
+++ b/pkg/analyzer/lib/src/error/codes.dart
@@ -2500,6 +2500,45 @@ class CompileTimeErrorCode extends AnalyzerErrorCode {
correction: "Change or remove the duplicate key.",
hasPublishedDocs: true);
+ /**
+ * 12.7 Lists: A fresh instance (7.6.1) a, of size n, whose
+ * class implements the built-in class List<E> is allocated.
+ *
+ * Parameters:
+ * 0: the number of provided type arguments
+ */
+ static const CompileTimeErrorCode EXPECTED_ONE_LIST_TYPE_ARGUMENTS =
+ CompileTimeErrorCode(
+ 'EXPECTED_ONE_LIST_TYPE_ARGUMENTS',
+ "List literals require exactly one type argument or none, "
+ "but {0} found.",
+ correction: "Try adjusting the number of type arguments.");
+
+ /**
+ * Parameters:
+ * 0: the number of provided type arguments
+ */
+ static const CompileTimeErrorCode EXPECTED_ONE_SET_TYPE_ARGUMENTS =
+ CompileTimeErrorCode(
+ 'EXPECTED_ONE_SET_TYPE_ARGUMENTS',
+ "Set literals require exactly one type argument or none, "
+ "but {0} found.",
+ correction: "Try adjusting the number of type arguments.");
+
+ /**
+ * 12.8 Maps: A fresh instance (7.6.1) m, of size n, whose class
+ * implements the built-in class Map<K, V> is allocated.
+ *
+ * Parameters:
+ * 0: the number of provided type arguments
+ */
+ static const CompileTimeErrorCode EXPECTED_TWO_MAP_TYPE_ARGUMENTS =
+ CompileTimeErrorCode(
+ 'EXPECTED_TWO_MAP_TYPE_ARGUMENTS',
+ "Map literals require exactly two type arguments or none, "
+ "but {0} found.",
+ correction: "Try adjusting the number of type arguments.");
+
/**
* SDK implementation libraries can be exported only by other SDK libraries.
*
@@ -3487,6 +3526,61 @@ class CompileTimeErrorCode extends AnalyzerErrorCode {
correction: "Try adding initializers for the fields.",
hasPublishedDocs: true);
+ /**
+ * 17.6.2 For-in. It the iterable expression does not implement Iterable with
+ * a type argument that can be assigned to the for-in variable's type, this
+ * warning is reported.
+ *
+ * Parameters:
+ * 0: The type of the iterable expression.
+ * 1: The sequence type -- Iterable for `for` or Stream for `await for`.
+ * 2: The loop variable type.
+ */
+ static const CompileTimeErrorCode FOR_IN_OF_INVALID_ELEMENT_TYPE =
+ CompileTimeErrorCode(
+ 'FOR_IN_OF_INVALID_ELEMENT_TYPE',
+ "The type '{0}' used in the 'for' loop must implement {1} with a "
+ "type argument that can be assigned to '{2}'.");
+
+ /**
+ * Parameters:
+ * 0: The type of the iterable expression.
+ * 1: The sequence type -- Iterable for `for` or Stream for `await for`.
+ */
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when the expression following `in` in
+ // a for-in loop has a type that isn't a subclass of `Iterable`.
+ //
+ // #### Examples
+ //
+ // The following code produces this diagnostic because `m` is a `Map`, and
+ // `Map` isn't a subclass of `Iterable`:
+ //
+ // ```dart
+ // void f(Map m) {
+ // for (String s in [!m!]) {
+ // print(s);
+ // }
+ // }
+ // ```
+ //
+ // #### Common fixes
+ //
+ // Replace the expression with one that produces an iterable value:
+ //
+ // ```dart
+ // void f(Map m) {
+ // for (String s in m.values) {
+ // print(s);
+ // }
+ // }
+ // ```
+ static const CompileTimeErrorCode FOR_IN_OF_INVALID_TYPE =
+ CompileTimeErrorCode('FOR_IN_OF_INVALID_TYPE',
+ "The type '{0}' used in the 'for' loop must implement {1}.",
+ hasPublishedDocs: true);
+
static const CompileTimeErrorCode FOR_IN_WITH_CONST_VARIABLE =
CompileTimeErrorCode('FOR_IN_WITH_CONST_VARIABLE',
"A for-in loop-variable can't be 'const'.",
@@ -3572,6 +3666,54 @@ class CompileTimeErrorCode extends AnalyzerErrorCode {
correction: "Try fixing the return type of the function, or "
"removing the modifier 'async*' from the function body.");
+ /**
+ * No parameters.
+ */
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when the body of a function has the
+ // `async` modifier even though the return type of the function isn't
+ // assignable to `Future`.
+ //
+ // #### Example
+ //
+ // The following code produces this diagnostic because the body of the
+ // function `f` has the `async` modifier even though the return type isn't
+ // assignable to `Future`:
+ //
+ // ```dart
+ // [!int!] f() async {
+ // return 0;
+ // }
+ // ```
+ //
+ // #### Common fixes
+ //
+ // If the function should be asynchronous, then change the return type to be
+ // assignable to `Future`:
+ //
+ // ```dart
+ // Future f() async {
+ // return 0;
+ // }
+ // ```
+ //
+ // If the function should be synchronous, then remove the `async` modifier:
+ //
+ // ```dart
+ // int f() {
+ // return 0;
+ // }
+ // ```
+ static const CompileTimeErrorCode ILLEGAL_ASYNC_RETURN_TYPE =
+ CompileTimeErrorCode(
+ 'ILLEGAL_ASYNC_RETURN_TYPE',
+ "Functions marked 'async' must have a return type assignable to "
+ "'Future'.",
+ correction: "Try fixing the return type of the function, or "
+ "removing the modifier 'async' from the function body.",
+ hasPublishedDocs: true);
+
/**
* It is a compile-time error if the declared return type of a function marked
* 'sync*' is not a supertype of 'Iterable' for some type 'T'.
@@ -4065,6 +4207,51 @@ class CompileTimeErrorCode extends AnalyzerErrorCode {
"in a constructor can't be static.",
correction: "Try removing the initialization.");
+ /**
+ * Parameters:
+ * 0: the name of the static member
+ * 1: the kind of the static member (field, getter, setter, or method)
+ * 2: the name of the defining class
+ */
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when an access operator is used to
+ // access a static member through an instance of the class.
+ //
+ // #### Examples
+ //
+ // The following code produces this diagnostic because `zero` is a static
+ // field, but it’s being accessed as if it were an instance field:
+ //
+ // ```dart
+ // void f(C c) {
+ // c.[!zero!];
+ // }
+ //
+ // class C {
+ // static int zero = 0;
+ // }
+ // ```
+ //
+ // #### Common fixes
+ //
+ // Use the class to access the static member:
+ //
+ // ```dart
+ // void f(C c) {
+ // C.zero;
+ // }
+ //
+ // class C {
+ // static int zero = 0;
+ // }
+ // ```
+ static const CompileTimeErrorCode INSTANCE_ACCESS_TO_STATIC_MEMBER =
+ CompileTimeErrorCode('INSTANCE_ACCESS_TO_STATIC_MEMBER',
+ "Static {1} '{0}' can't be accessed through an instance.",
+ correction: "Try using the class '{2}' to access the {1}.",
+ hasPublishedDocs: true);
+
/**
* No parameters.
*/
@@ -4271,6 +4458,56 @@ class CompileTimeErrorCode extends AnalyzerErrorCode {
'INVALID_ANNOTATION_GETTER', "Getters can't be used as annotations.",
correction: "Try using a top-level variable or a field.");
+ /**
+ * Parameters:
+ * 0: the name of the right hand side type
+ * 1: the name of the left hand side type
+ */
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when the static type of an expression
+ // that is assigned to a variable isn't assignable to the type of the
+ // variable.
+ //
+ // #### Examples
+ //
+ // The following code produces this diagnostic because the type of the
+ // initializer (`int`) isn't assignable to the type of the variable
+ // (`String`):
+ //
+ // ```dart
+ // int i = 0;
+ // String s = [!i!];
+ // ```
+ //
+ // #### Common fixes
+ //
+ // If the value being assigned is always assignable at runtime, even though
+ // the static types don't reflect that, then add an explicit cast.
+ //
+ // Otherwise, change the value being assigned so that it has the expected
+ // type. In the previous example, this might look like:
+ //
+ // ```dart
+ // int i = 0;
+ // String s = i.toString();
+ // ```
+ //
+ // If you can’t change the value, then change the type of the variable to be
+ // compatible with the type of the value being assigned:
+ //
+ // ```dart
+ // int i = 0;
+ // int s = i;
+ // ```
+ static const CompileTimeErrorCode INVALID_ASSIGNMENT = CompileTimeErrorCode(
+ 'INVALID_ASSIGNMENT',
+ "A value of type '{0}' can't be assigned to a variable of type "
+ "'{1}'.",
+ correction: "Try changing the type of the variable, or "
+ "casting the right-hand type to '{1}'.",
+ hasPublishedDocs: true);
+
/**
* Parameters:
* 0: the type of the function
@@ -4792,6 +5029,94 @@ class CompileTimeErrorCode extends AnalyzerErrorCode {
"can't be used in an invocation.",
hasPublishedDocs: true);
+ /**
+ * Parameters:
+ * 0: the name of the identifier that is not a function type
+ */
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when it finds a function invocation,
+ // but the name of the function being invoked is defined to be something other
+ // than a function.
+ //
+ // #### Examples
+ //
+ // The following code produces this diagnostic because `Binary` is the name of
+ // a function type, not a function:
+ //
+ // ```dart
+ // typedef Binary = int Function(int, int);
+ //
+ // int f() {
+ // return [!Binary!](1, 2);
+ // }
+ // ```
+ //
+ // #### Common fixes
+ //
+ // Replace the name with the name of a function.
+ static const CompileTimeErrorCode INVOCATION_OF_NON_FUNCTION =
+ CompileTimeErrorCode(
+ 'INVOCATION_OF_NON_FUNCTION', "'{0}' isn't a function.",
+ // TODO(brianwilkerson) Split this error code so that we can provide
+ // better error and correction messages.
+ correction:
+ "Try correcting the name to match an existing function, or "
+ "define a method or function named '{0}'.",
+ hasPublishedDocs: true);
+
+ /**
+ * No parameters.
+ */
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when a function invocation is found,
+ // but the name being referenced isn't the name of a function, or when the
+ // expression computing the function doesn't compute a function.
+ //
+ // #### Examples
+ //
+ // The following code produces this diagnostic because `x` isn't a function:
+ //
+ // ```dart
+ // int x = 0;
+ //
+ // int f() => x;
+ //
+ // var y = [!x!]();
+ // ```
+ //
+ // The following code produces this diagnostic because `f()` doesn't return a
+ // function:
+ //
+ // ```dart
+ // int x = 0;
+ //
+ // int f() => x;
+ //
+ // var y = [!f()!]();
+ // ```
+ //
+ // #### Common fixes
+ //
+ // If you need to invoke a function, then replace the code before the argument
+ // list with the name of a function or with an expression that computes a
+ // function:
+ //
+ // ```dart
+ // int x = 0;
+ //
+ // int f() => x;
+ //
+ // var y = f();
+ // ```
+ static const CompileTimeErrorCode INVOCATION_OF_NON_FUNCTION_EXPRESSION =
+ CompileTimeErrorCode(
+ 'INVOCATION_OF_NON_FUNCTION_EXPRESSION',
+ "The expression doesn't evaluate to a function, so it can't be "
+ "invoked.",
+ hasPublishedDocs: true);
+
/**
* 13.13 Break: It is a compile-time error if no such statement
* sE exists within the innermost function in which
@@ -5734,6 +6059,140 @@ class CompileTimeErrorCode extends AnalyzerErrorCode {
"abstract.",
hasPublishedDocs: true);
+ /**
+ * No parameters.
+ */
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when a condition, such as an `if` or
+ // `while` loop, doesn't have the static type `bool`.
+ //
+ // #### Examples
+ //
+ // The following code produces this diagnostic because `x` has the static type
+ // `int`:
+ //
+ // ```dart
+ // void f(int x) {
+ // if ([!x!]) {
+ // // ...
+ // }
+ // }
+ // ```
+ //
+ // #### Common fixes
+ //
+ // Change the condition so that it produces a Boolean value:
+ //
+ // ```dart
+ // void f(int x) {
+ // if (x == 0) {
+ // // ...
+ // }
+ // }
+ // ```
+ static const CompileTimeErrorCode NON_BOOL_CONDITION = CompileTimeErrorCode(
+ 'NON_BOOL_CONDITION', "Conditions must have a static type of 'bool'.",
+ correction: "Try changing the condition.", hasPublishedDocs: true);
+
+ /**
+ * No parameters.
+ */
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when the first expression in an
+ // assert has a type other than `bool`.
+ //
+ // #### Examples
+ //
+ // The following code produces this diagnostic because the type of `p` is
+ // `int`, but a `bool` is required:
+ //
+ // ```dart
+ // void f(int p) {
+ // assert([!p!]);
+ // }
+ // ```
+ //
+ // #### Common fixes
+ //
+ // Change the expression so that it has the type `bool`:
+ //
+ // ```dart
+ // void f(int p) {
+ // assert(p > 0);
+ // }
+ // ```
+ static const CompileTimeErrorCode NON_BOOL_EXPRESSION = CompileTimeErrorCode(
+ 'NON_BOOL_EXPRESSION',
+ "The expression in an assert must be of type 'bool'.",
+ correction: "Try changing the expression.",
+ hasPublishedDocs: true);
+
+ /**
+ * No parameters.
+ */
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when the operand of the unary
+ // negation operator (`!`) doesn't have the type `bool`.
+ //
+ // #### Examples
+ //
+ // The following code produces this diagnostic because `x` is an `int` when it
+ // must be a `bool`:
+ //
+ // ```dart
+ // int x = 0;
+ // bool y = ![!x!];
+ // ```
+ //
+ // #### Common fixes
+ //
+ // Replace the operand with an expression that has the type `bool`:
+ //
+ // ```dart
+ // int x = 0;
+ // bool y = !(x > 0);
+ // ```
+ static const CompileTimeErrorCode NON_BOOL_NEGATION_EXPRESSION =
+ CompileTimeErrorCode('NON_BOOL_NEGATION_EXPRESSION',
+ "A negation operand must have a static type of 'bool'.",
+ correction: "Try changing the operand to the '!' operator.",
+ hasPublishedDocs: true);
+
+ /**
+ * Parameters:
+ * 0: the lexeme of the logical operator
+ */
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when one of the operands of either
+ // the `&&` or `||` operator doesn't have the type `bool`.
+ //
+ // #### Examples
+ //
+ // The following code produces this diagnostic because `a` isn't a Boolean
+ // value:
+ //
+ // ```dart
+ // int a = 3;
+ // bool b = [!a!] || a > 1;
+ // ```
+ //
+ // #### Common fixes
+ //
+ // Change the operand to a Boolean value:
+ //
+ // ```dart
+ // int a = 3;
+ // bool b = a == 0 || a > 1;
+ // ```
+ static const CompileTimeErrorCode NON_BOOL_OPERAND = CompileTimeErrorCode(
+ 'NON_BOOL_OPERAND',
+ "The operands of the operator '{0}' must be assignable to 'bool'.",
+ hasPublishedDocs: true);
+
/**
* 13.2 Expression Statements: It is a compile-time error if a non-constant
* map literal that has no explicit type arguments appears in a place where a
@@ -6189,6 +6648,41 @@ class CompileTimeErrorCode extends AnalyzerErrorCode {
'NON_SYNC_FACTORY',
"Factory bodies can't use 'async', 'async*', or 'sync*'.");
+ /**
+ * Parameters:
+ * 0: the name appearing where a type is expected
+ */
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when an identifier that isn't a type
+ // is used as a type argument.
+ //
+ // #### Examples
+ //
+ // The following code produces this diagnostic because `x` is a variable, not
+ // a type:
+ //
+ // ```dart
+ // var x = 0;
+ // List<[!x!]> xList = [];
+ // ```
+ //
+ // #### Common fixes
+ //
+ // Change the type argument to be a type:
+ //
+ // ```dart
+ // var x = 0;
+ // List xList = [];
+ // ```
+ static const CompileTimeErrorCode NON_TYPE_AS_TYPE_ARGUMENT =
+ CompileTimeErrorCode('NON_TYPE_AS_TYPE_ARGUMENT',
+ "The name '{0}' isn't a type so it can't be used as a type argument.",
+ correction: "Try correcting the name to an existing type, or "
+ "defining a type named '{0}'.",
+ hasPublishedDocs: true,
+ isUnresolvedIdentifier: true);
+
/**
* Parameters:
* 0: the name of the non-type element
@@ -7593,6 +8087,112 @@ class CompileTimeErrorCode extends AnalyzerErrorCode {
correction: "Try removing the value, replacing 'return' with 'yield' or "
"changing the method body modifier.");
+ /**
+ * Parameters:
+ * 0: the return type as declared in the return statement
+ * 1: the expected return type as defined by the method
+ */
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when the static type of a returned
+ // expression isn't assignable to the return type that the closure is required
+ // to have.
+ //
+ // #### Examples
+ //
+ // The following code produces this diagnostic because `f` is defined to be a
+ // function that returns a `String`, but the closure assigned to it returns an
+ // `int`:
+ //
+ // ```dart
+ // String Function(String) f = (s) => [!3!];
+ // ```
+ //
+ // #### Common fixes
+ //
+ // If the return type is correct, then replace the returned value with a value
+ // of the correct type, possibly by converting the existing value:
+ //
+ // ```dart
+ // String Function(String) f = (s) => 3.toString();
+ // ```
+ static const CompileTimeErrorCode RETURN_OF_INVALID_TYPE_FROM_CLOSURE =
+ CompileTimeErrorCode(
+ 'RETURN_OF_INVALID_TYPE_FROM_CLOSURE',
+ "The return type '{0}' isn't a '{1}', as required by the closure's "
+ "context.",
+ hasPublishedDocs: true);
+
+ /**
+ * Parameters:
+ * 0: the return type as declared in the return statement
+ * 1: the expected return type as defined by the enclosing class
+ * 2: the name of the constructor
+ */
+ static const CompileTimeErrorCode RETURN_OF_INVALID_TYPE_FROM_CONSTRUCTOR =
+ CompileTimeErrorCodeWithUniqueName(
+ 'RETURN_OF_INVALID_TYPE',
+ 'CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_CONSTRUCTOR',
+ "A value of type '{0}' can't be returned from constructor '{2}' "
+ "because it has a return type of '{1}'.",
+ hasPublishedDocs: true);
+
+ /**
+ * Parameters:
+ * 0: the return type as declared in the return statement
+ * 1: the expected return type as defined by the method
+ * 2: the name of the method
+ */
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when a method or function returns a
+ // value whose type isn't assignable to the declared return type.
+ //
+ // #### Examples
+ //
+ // The following code produces this diagnostic because `f` has a return type
+ // of `String` but is returning an `int`:
+ //
+ // ```dart
+ // String f() => [!3!];
+ // ```
+ //
+ // #### Common fixes
+ //
+ // If the return type is correct, then replace the value being returned with a
+ // value of the correct type, possibly by converting the existing value:
+ //
+ // ```dart
+ // String f() => 3.toString();
+ // ```
+ //
+ // If the value is correct, then change the return type to match:
+ //
+ // ```dart
+ // int f() => 3;
+ // ```
+ static const CompileTimeErrorCode RETURN_OF_INVALID_TYPE_FROM_FUNCTION =
+ CompileTimeErrorCodeWithUniqueName(
+ 'RETURN_OF_INVALID_TYPE',
+ 'CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION',
+ "A value of type '{0}' can't be returned from function '{2}' because "
+ "it has a return type of '{1}'.",
+ hasPublishedDocs: true);
+
+ /**
+ * Parameters:
+ * 0: the return type as declared in the return statement
+ * 1: the expected return type as defined by the method
+ * 2: the name of the method
+ */
+ static const CompileTimeErrorCode RETURN_OF_INVALID_TYPE_FROM_METHOD =
+ CompileTimeErrorCodeWithUniqueName(
+ 'RETURN_OF_INVALID_TYPE',
+ 'CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_METHOD',
+ "A value of type '{0}' can't be returned from method '{2}' because "
+ "it has a return type of '{1}'.",
+ hasPublishedDocs: true);
+
/**
* No parameters.
*/
@@ -7991,6 +8591,21 @@ class CompileTimeErrorCode extends AnalyzerErrorCode {
correction: "Try removing the reference to the type parameter, or "
"making the member an instance member.");
+ /**
+ * 10 Generics: It is a static type warning if a type parameter is a supertype
+ * of its upper bound.
+ *
+ * Parameters:
+ * 0: the name of the type parameter
+ * 1: the name of the bounding type
+ *
+ * See [CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS].
+ */
+ static const CompileTimeErrorCode TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND =
+ CompileTimeErrorCode('TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND',
+ "'{0}' can't be a supertype of its upper bound.",
+ correction: "Try using a type that is or is a subclass of '{1}'.");
+
/**
* 12.31 Type Test: It is a static warning if T does not denote a type
* available in the current lexical scope.
@@ -8293,6 +8908,55 @@ class CompileTimeErrorCode extends AnalyzerErrorCode {
correction: "Try defining an unnamed constructor in '{0}', or "
"invoking a different constructor.");
+ /**
+ * Parameters:
+ * 0: the name of the enumeration constant that is not defined
+ * 1: the name of the enumeration used to access the constant
+ */
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when it encounters an identifier that
+ // appears to be the name of an enum constant, and the name either isn't
+ // defined or isn't visible in the scope in which it's being referenced.
+ //
+ // #### Examples
+ //
+ // The following code produces this diagnostic because `E` doesn't define a
+ // constant named `c`:
+ //
+ // ```dart
+ // enum E {a, b}
+ //
+ // var e = E.[!c!];
+ // ```
+ //
+ // #### Common fixes
+ //
+ // If the constant should be defined, then add it to the declaration of the
+ // enum:
+ //
+ // ```dart
+ // enum E {a, b, c}
+ //
+ // var e = E.c;
+ // ```
+ //
+ // If the constant shouldn't be defined, then change the name to the name of
+ // an existing constant:
+ //
+ // ```dart
+ // enum E {a, b}
+ //
+ // var e = E.b;
+ // ```
+ static const CompileTimeErrorCode UNDEFINED_ENUM_CONSTANT =
+ CompileTimeErrorCode('UNDEFINED_ENUM_CONSTANT',
+ "There's no constant named '{0}' in '{1}'.",
+ correction:
+ "Try correcting the name to the name of an existing constant, or "
+ "defining a constant named '{0}'.",
+ hasPublishedDocs: true);
+
/**
* Parameters:
* 0: the name of the getter that is undefined
@@ -8608,6 +9272,89 @@ class CompileTimeErrorCode extends AnalyzerErrorCode {
"defining a setter named '{0}'.",
hasPublishedDocs: true);
+ /**
+ * Parameters:
+ * 0: the name of the method that is undefined
+ */
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when it encounters an identifier that
+ // appears to be the name of a function but either isn't defined or isn't
+ // visible in the scope in which it's being referenced.
+ //
+ // #### Examples
+ //
+ // The following code produces this diagnostic because the name `emty` isn't
+ // defined:
+ //
+ // ```dart
+ // List empty() => [];
+ //
+ // void main() {
+ // print([!emty!]());
+ // }
+ // ```
+ //
+ // #### Common fixes
+ //
+ // If the identifier isn't defined, then either define it or replace it with
+ // the name of a function that is defined. The example above can be corrected
+ // by fixing the spelling of the function:
+ //
+ // ```dart
+ // List empty() => [];
+ //
+ // void main() {
+ // print(empty());
+ // }
+ // ```
+ //
+ // If the function is defined but isn't visible, then you probably need to add
+ // an import or re-arrange your code to make the function visible.
+ static const CompileTimeErrorCode UNDEFINED_FUNCTION = CompileTimeErrorCode(
+ 'UNDEFINED_FUNCTION', "The function '{0}' isn't defined.",
+ correction: "Try importing the library that defines '{0}', "
+ "correcting the name to the name of an existing function, or "
+ "defining a function named '{0}'.",
+ hasPublishedDocs: true,
+ isUnresolvedIdentifier: true);
+
+ /**
+ * Parameters:
+ * 0: the name of the getter
+ * 1: the name of the enclosing type where the getter is being looked for
+ */
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when it encounters an identifier that
+ // appears to be the name of a getter but either isn't defined or isn't
+ // visible in the scope in which it's being referenced.
+ //
+ // #### Examples
+ //
+ // The following code produces this diagnostic because `String` has no member
+ // named `len`:
+ //
+ // ```dart
+ // int f(String s) => s.[!len!];
+ // ```
+ //
+ // #### Common fixes
+ //
+ // If the identifier isn't defined, then either define it or replace it with
+ // the name of a getter that is defined. The example above can be corrected by
+ // fixing the spelling of the getter:
+ //
+ // ```dart
+ // int f(String s) => s.length;
+ // ```
+ static const CompileTimeErrorCode UNDEFINED_GETTER = CompileTimeErrorCode(
+ 'UNDEFINED_GETTER', "The getter '{0}' isn't defined for the type '{1}'.",
+ correction: "Try importing the library that defines '{0}', "
+ "correcting the name to the name of an existing getter, or "
+ "defining a getter or field named '{0}'.",
+ hasPublishedDocs: true);
+
/**
* Parameters:
* 0: the name of the identifier
@@ -8681,6 +9428,42 @@ class CompileTimeErrorCode extends AnalyzerErrorCode {
"adding 'async' to the enclosing function body.",
hasPublishedDocs: true);
+ /**
+ * Parameters:
+ * 0: the name of the method that is undefined
+ * 1: the resolved type name that the method lookup is happening on
+ */
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when it encounters an identifier that
+ // appears to be the name of a method but either isn't defined or isn't
+ // visible in the scope in which it's being referenced.
+ //
+ // #### Examples
+ //
+ // The following code produces this diagnostic because the identifier
+ // `removeMiddle` isn't defined:
+ //
+ // ```dart
+ // int f(List l) => l.[!removeMiddle!]();
+ // ```
+ //
+ // #### Common fixes
+ //
+ // If the identifier isn't defined, then either define it or replace it with
+ // the name of a method that is defined. The example above can be corrected by
+ // fixing the spelling of the method:
+ //
+ // ```dart
+ // int f(List l) => l.removeLast();
+ // ```
+ static const CompileTimeErrorCode UNDEFINED_METHOD = CompileTimeErrorCode(
+ 'UNDEFINED_METHOD', "The method '{0}' isn't defined for the type '{1}'.",
+ correction:
+ "Try correcting the name to the name of an existing method, or "
+ "defining a method named '{0}'.",
+ hasPublishedDocs: true);
+
/**
* Parameters:
* 0: the name of the requested named parameter
@@ -8757,6 +9540,245 @@ class CompileTimeErrorCode extends AnalyzerErrorCode {
"or defining a named parameter with the name '{0}'.",
hasPublishedDocs: true);
+ /**
+ * Parameters:
+ * 0: the name of the operator
+ * 1: the name of the enclosing type where the operator is being looked for
+ */
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when a user-definable operator is
+ // invoked on an object for which the operator isn't defined.
+ //
+ // #### Examples
+ //
+ // The following code produces this diagnostic because the class `C` doesn't
+ // define the operator `+`:
+ //
+ // ```dart
+ // class C {}
+ //
+ // C f(C c) => c [!+!] 2;
+ // ```
+ //
+ // #### Common fixes
+ //
+ // If the operator should be defined for the class, then define it:
+ //
+ // ```dart
+ // class C {
+ // C operator +(int i) => this;
+ // }
+ //
+ // C f(C c) => c + 2;
+ // ```
+ static const CompileTimeErrorCode UNDEFINED_OPERATOR = CompileTimeErrorCode(
+ 'UNDEFINED_OPERATOR',
+ "The operator '{0}' isn't defined for the type '{1}'.",
+ correction: "Try defining the operator '{0}'.",
+ hasPublishedDocs: true);
+
+ /**
+ * No parameters.
+ */
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when a prefixed identifier is found
+ // where the prefix is valid, but the identifier isn't declared in any of the
+ // libraries imported using that prefix.
+ //
+ // #### Examples
+ //
+ // The following code produces this diagnostic because `dart:core` doesn't
+ // define anything named `a`:
+ //
+ // ```dart
+ // import 'dart:core' as p;
+ //
+ // void f() {
+ // p.[!a!];
+ // }
+ // ```
+ //
+ // #### Common fixes
+ //
+ // If the library in which the name is declared isn't imported yet, add an
+ // import for the library.
+ //
+ // If the name is wrong, then change it to one of the names that's declared in
+ // the imported libraries.
+ static const CompileTimeErrorCode UNDEFINED_PREFIXED_NAME =
+ CompileTimeErrorCode(
+ 'UNDEFINED_PREFIXED_NAME',
+ "The name '{0}' is being referenced through the prefix '{1}', but it "
+ "isn't defined in any of the libraries imported using that "
+ "prefix.",
+ correction: "Try correcting the prefix or "
+ "importing the library that defines '{0}'.",
+ hasPublishedDocs: true);
+
+ /**
+ * Parameters:
+ * 0: the name of the setter
+ * 1: the name of the enclosing type where the setter is being looked for
+ */
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when it encounters an identifier that
+ // appears to be the name of a setter but either isn't defined or isn't
+ // visible in the scope in which the identifier is being referenced.
+ //
+ // #### Examples
+ //
+ // The following code produces this diagnostic because there isn't a setter
+ // named `z`:
+ //
+ // ```dart
+ // class C {
+ // int x = 0;
+ // void m(int y) {
+ // this.[!z!] = y;
+ // }
+ // }
+ // ```
+ //
+ // #### Common fixes
+ //
+ // If the identifier isn't defined, then either define it or replace it with
+ // the name of a setter that is defined. The example above can be corrected by
+ // fixing the spelling of the setter:
+ //
+ // ```dart
+ // class C {
+ // int x = 0;
+ // void m(int y) {
+ // this.x = y;
+ // }
+ // }
+ // ```
+ static const CompileTimeErrorCode UNDEFINED_SETTER = CompileTimeErrorCode(
+ 'UNDEFINED_SETTER', "The setter '{0}' isn't defined for the type '{1}'.",
+ correction: "Try importing the library that defines '{0}', "
+ "correcting the name to the name of an existing setter, or "
+ "defining a setter or field named '{0}'.",
+ hasPublishedDocs: true);
+
+ /**
+ * 12.17 Getter Invocation: Let T be the static type of e. It is
+ * a static type warning if T does not have a getter named m.
+ *
+ * Parameters:
+ * 0: the name of the getter
+ * 1: the name of the enclosing type where the getter is being looked for
+ */
+ static const CompileTimeErrorCode UNDEFINED_SUPER_GETTER =
+ CompileTimeErrorCode('UNDEFINED_SUPER_GETTER',
+ "The getter '{0}' isn't defined in a superclass of '{1}'.",
+ correction:
+ "Try correcting the name to the name of an existing getter, or "
+ "defining a getter or field named '{0}' in a superclass.");
+
+ /**
+ * Parameters:
+ * 0: the name of the method that is undefined
+ * 1: the resolved type name that the method lookup is happening on
+ */
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when an inherited method is
+ // referenced using `super`, but there’s no method with that name in the
+ // superclass chain.
+ //
+ // #### Examples
+ //
+ // The following code produces this diagnostic because `Object` doesn't define
+ // a member named `n`:
+ //
+ // ```dart
+ // class C {
+ // void m() {
+ // super.[!n!]();
+ // }
+ // }
+ // ```
+ //
+ // #### Common fixes
+ //
+ // If the inherited method you intend to invoke has a different name, then
+ // make the name of the invoked method match the inherited method.
+ //
+ // If the method you intend to invoke is defined in the same class, then
+ // remove the `super.`.
+ //
+ // If not, then either add the method to one of the superclasses or remove the
+ // invocation.
+ static const CompileTimeErrorCode UNDEFINED_SUPER_METHOD =
+ CompileTimeErrorCode('UNDEFINED_SUPER_METHOD',
+ "The method '{0}' isn't defined in a superclass of '{1}'.",
+ correction:
+ "Try correcting the name to the name of an existing method, or "
+ "defining a method named '{0}' in a superclass.",
+ hasPublishedDocs: true);
+
+ /**
+ * 12.18 Assignment: Evaluation of an assignment of the form
+ * e1[e2] = e3 is
+ * equivalent to the evaluation of the expression (a, i, e){a.[]=(i, e);
+ * return e;} (e1, e2,
+ * e2).
+ *
+ * 12.29 Assignable Expressions: An assignable expression of the form
+ * e1[e2] is evaluated as a method
+ * invocation of the operator method [] on e1 with argument
+ * e2.
+ *
+ * 12.15.1 Ordinary Invocation: Let T be the static type of o.
+ * It is a static type warning if T does not have an accessible
+ * instance member named m.
+ *
+ * Parameters:
+ * 0: the name of the operator
+ * 1: the name of the enclosing type where the operator is being looked for
+ */
+ static const CompileTimeErrorCode UNDEFINED_SUPER_OPERATOR =
+ CompileTimeErrorCode('UNDEFINED_SUPER_OPERATOR',
+ "The operator '{0}' isn't defined in a superclass of '{1}'.",
+ correction: "Try defining the operator '{0}' in a superclass.");
+
+ /**
+ * 12.18 Assignment: Let T be the static type of e1.
+ * It is a static type warning if T does not have an accessible
+ * instance setter named v=.
+ *
+ * Parameters:
+ * 0: the name of the setter
+ * 1: the name of the enclosing type where the setter is being looked for
+ */
+ static const CompileTimeErrorCode UNDEFINED_SUPER_SETTER =
+ CompileTimeErrorCode('UNDEFINED_SUPER_SETTER',
+ "The setter '{0}' isn't defined in a superclass of '{1}'.",
+ correction:
+ "Try correcting the name to the name of an existing setter, or "
+ "defining a setter or field named '{0}' in a superclass.");
+
+ /**
+ * 12.15.1 Ordinary Invocation: It is a static type warning if T does
+ * not have an accessible (3.2) instance member named m.
+ *
+ * This is a specialization of [INSTANCE_ACCESS_TO_STATIC_MEMBER] that is used
+ * when we are able to find the name defined in a supertype. It exists to
+ * provide a more informative error message.
+ *
+ * Parameters:
+ * 0: the name of the defining type
+ */
+ static const CompileTimeErrorCode
+ UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER = CompileTimeErrorCode(
+ 'UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER',
+ "Static members from supertypes must be qualified by the name of the "
+ "defining type.",
+ correction: "Try adding '{0}.' before the name.");
+
/**
* Parameters:
* 0: the name of the defining type
@@ -9068,6 +10090,92 @@ class CompileTimeErrorCode extends AnalyzerErrorCode {
"Setters must declare exactly one required positional parameter.",
hasPublishedDocs: true);
+ /**
+ * Parameters:
+ * 0: the name of the type being referenced (G)
+ * 1: the number of type parameters that were declared
+ * 2: the number of type arguments provided
+ */
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when a type that has type parameters
+ // is used and type arguments are provided, but the number of type arguments
+ // isn't the same as the number of type parameters.
+ //
+ // The analyzer also produces this diagnostic when a constructor is invoked
+ // and the number of type arguments doesn't match the number of type
+ // parameters declared for the class.
+ //
+ // #### Examples
+ //
+ // The following code produces this diagnostic because `C` has one type
+ // parameter but two type arguments are provided when it is used as a type
+ // annotation:
+ //
+ // ```dart
+ // class C {}
+ //
+ // void f([!C!] x) {}
+ // ```
+ //
+ // The following code produces this diagnostic because `C` declares one type
+ // parameter, but two type arguments are provided when creating an instance:
+ //
+ // ```dart
+ // class C {}
+ //
+ // var c = [!C!]();
+ // ```
+ //
+ // #### Common fixes
+ //
+ // Add or remove type arguments, as necessary, to match the number of type
+ // parameters defined for the type:
+ //
+ // ```dart
+ // class C {}
+ //
+ // void f(C x) {}
+ // ```
+ static const CompileTimeErrorCode WRONG_NUMBER_OF_TYPE_ARGUMENTS =
+ CompileTimeErrorCode(
+ 'WRONG_NUMBER_OF_TYPE_ARGUMENTS',
+ "The type '{0}' is declared with {1} type parameters, "
+ "but {2} type arguments were given.",
+ correction:
+ "Try adjusting the number of type arguments to match the number "
+ "of type parameters.",
+ hasPublishedDocs: true);
+
+ /**
+ * It will be a static type warning if m is not a generic method with
+ * exactly n type parameters.
+ *
+ * Parameters:
+ * 0: the name of the class being instantiated
+ * 1: the name of the constructor being invoked
+ */
+ static const CompileTimeErrorCode WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR =
+ CompileTimeErrorCode('WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR',
+ "The constructor '{0}.{1}' doesn't have type parameters.",
+ correction: "Try moving type arguments to after the type name.");
+
+ /**
+ * It will be a static type warning if m is not a generic method with
+ * exactly n type parameters.
+ *
+ * Parameters:
+ * 0: the name of the method being referenced (G)
+ * 1: the number of type parameters that were declared
+ * 2: the number of type arguments provided
+ */
+ static const CompileTimeErrorCode WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD =
+ CompileTimeErrorCode(
+ 'WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD',
+ "The method '{0}' is declared with {1} type parameters, "
+ "but {2} type arguments were given.",
+ correction: "Try adjusting the number of type arguments.");
+
/**
* Let `C` be a generic class that declares a formal type parameter `X`, and
* assume that `T` is a direct superinterface of `C`. It is a compile-time
@@ -9133,6 +10241,30 @@ class CompileTimeErrorCode extends AnalyzerErrorCode {
correction:
"Try adding 'async*' or 'sync*' to the enclosing function.");
+ /**
+ * 17.16.1 Yield: Let T be the static type of e [the expression to the right
+ * of "yield"] and let f be the immediately enclosing function. It is a
+ * static type warning if either:
+ *
+ * - the body of f is marked async* and the type Stream may not be
+ * assigned to the declared return type of f.
+ *
+ * - the body of f is marked sync* and the type Iterable may not be
+ * assigned to the declared return type of f.
+ *
+ * 17.16.2 Yield-Each: Let T be the static type of e [the expression to the
+ * right of "yield*"] and let f be the immediately enclosing function. It is
+ * a static type warning if T may not be assigned to the declared return type
+ * of f. If f is synchronous it is a static type warning if T may not be
+ * assigned to Iterable. If f is asynchronous it is a static type warning if
+ * T may not be assigned to Stream.
+ */
+ static const CompileTimeErrorCode YIELD_OF_INVALID_TYPE =
+ CompileTimeErrorCode(
+ 'YIELD_OF_INVALID_TYPE',
+ "The type '{0}' implied by the 'yield' expression must be assignable "
+ "to '{1}'.");
+
/**
* Initialize a newly created error code to have the given [name]. The message
* associated with the error will be created from the given [message]
@@ -9170,1178 +10302,6 @@ class CompileTimeErrorCodeWithUniqueName extends CompileTimeErrorCode {
isUnresolvedIdentifier: isUnresolvedIdentifier);
}
-/**
- * The error codes used for static type warnings. The convention for this class
- * is for the name of the error code to indicate the problem that caused the
- * error to be generated and for the error message to explain what is wrong and,
- * when appropriate, how the problem can be corrected.
- */
-class StaticTypeWarningCode extends AnalyzerErrorCode {
- /**
- * 12.7 Lists: A fresh instance (7.6.1) a, of size n, whose
- * class implements the built-in class List<E> is allocated.
- *
- * Parameters:
- * 0: the number of provided type arguments
- */
- static const StaticTypeWarningCode EXPECTED_ONE_LIST_TYPE_ARGUMENTS =
- StaticTypeWarningCode(
- 'EXPECTED_ONE_LIST_TYPE_ARGUMENTS',
- "List literals require exactly one type argument or none, "
- "but {0} found.",
- correction: "Try adjusting the number of type arguments.");
-
- /**
- * Parameters:
- * 0: the number of provided type arguments
- */
- static const StaticTypeWarningCode EXPECTED_ONE_SET_TYPE_ARGUMENTS =
- StaticTypeWarningCode(
- 'EXPECTED_ONE_SET_TYPE_ARGUMENTS',
- "Set literals require exactly one type argument or none, "
- "but {0} found.",
- correction: "Try adjusting the number of type arguments.");
-
- /**
- * 12.8 Maps: A fresh instance (7.6.1) m, of size n, whose class
- * implements the built-in class Map<K, V> is allocated.
- *
- * Parameters:
- * 0: the number of provided type arguments
- */
- static const StaticTypeWarningCode EXPECTED_TWO_MAP_TYPE_ARGUMENTS =
- StaticTypeWarningCode(
- 'EXPECTED_TWO_MAP_TYPE_ARGUMENTS',
- "Map literals require exactly two type arguments or none, "
- "but {0} found.",
- correction: "Try adjusting the number of type arguments.");
-
- /**
- * 17.6.2 For-in. It the iterable expression does not implement Iterable with
- * a type argument that can be assigned to the for-in variable's type, this
- * warning is reported.
- *
- * Parameters:
- * 0: The type of the iterable expression.
- * 1: The sequence type -- Iterable for `for` or Stream for `await for`.
- * 2: The loop variable type.
- */
- static const StaticTypeWarningCode FOR_IN_OF_INVALID_ELEMENT_TYPE =
- StaticTypeWarningCode(
- 'FOR_IN_OF_INVALID_ELEMENT_TYPE',
- "The type '{0}' used in the 'for' loop must implement {1} with a "
- "type argument that can be assigned to '{2}'.");
-
- /**
- * Parameters:
- * 0: The type of the iterable expression.
- * 1: The sequence type -- Iterable for `for` or Stream for `await for`.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the expression following `in` in
- // a for-in loop has a type that isn't a subclass of `Iterable`.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because `m` is a `Map`, and
- // `Map` isn't a subclass of `Iterable`:
- //
- // ```dart
- // void f(Map m) {
- // for (String s in [!m!]) {
- // print(s);
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // Replace the expression with one that produces an iterable value:
- //
- // ```dart
- // void f(Map m) {
- // for (String s in m.values) {
- // print(s);
- // }
- // }
- // ```
- static const StaticTypeWarningCode FOR_IN_OF_INVALID_TYPE =
- StaticTypeWarningCode('FOR_IN_OF_INVALID_TYPE',
- "The type '{0}' used in the 'for' loop must implement {1}.",
- hasPublishedDocs: true);
-
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the body of a function has the
- // `async` modifier even though the return type of the function isn't
- // assignable to `Future`.
- //
- // #### Example
- //
- // The following code produces this diagnostic because the body of the
- // function `f` has the `async` modifier even though the return type isn't
- // assignable to `Future`:
- //
- // ```dart
- // [!int!] f() async {
- // return 0;
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the function should be asynchronous, then change the return type to be
- // assignable to `Future`:
- //
- // ```dart
- // Future f() async {
- // return 0;
- // }
- // ```
- //
- // If the function should be synchronous, then remove the `async` modifier:
- //
- // ```dart
- // int f() {
- // return 0;
- // }
- // ```
- static const StaticTypeWarningCode ILLEGAL_ASYNC_RETURN_TYPE =
- StaticTypeWarningCode(
- 'ILLEGAL_ASYNC_RETURN_TYPE',
- "Functions marked 'async' must have a return type assignable to "
- "'Future'.",
- correction: "Try fixing the return type of the function, or "
- "removing the modifier 'async' from the function body.",
- hasPublishedDocs: true);
-
- /**
- * Parameters:
- * 0: the name of the static member
- * 1: the kind of the static member (field, getter, setter, or method)
- * 2: the name of the defining class
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an access operator is used to
- // access a static member through an instance of the class.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because `zero` is a static
- // field, but it’s being accessed as if it were an instance field:
- //
- // ```dart
- // void f(C c) {
- // c.[!zero!];
- // }
- //
- // class C {
- // static int zero = 0;
- // }
- // ```
- //
- // #### Common fixes
- //
- // Use the class to access the static member:
- //
- // ```dart
- // void f(C c) {
- // C.zero;
- // }
- //
- // class C {
- // static int zero = 0;
- // }
- // ```
- static const StaticTypeWarningCode INSTANCE_ACCESS_TO_STATIC_MEMBER =
- StaticTypeWarningCode('INSTANCE_ACCESS_TO_STATIC_MEMBER',
- "Static {1} '{0}' can't be accessed through an instance.",
- correction: "Try using the class '{2}' to access the {1}.",
- hasPublishedDocs: true);
-
- /**
- * Parameters:
- * 0: the name of the right hand side type
- * 1: the name of the left hand side type
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the static type of an expression
- // that is assigned to a variable isn't assignable to the type of the
- // variable.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because the type of the
- // initializer (`int`) isn't assignable to the type of the variable
- // (`String`):
- //
- // ```dart
- // int i = 0;
- // String s = [!i!];
- // ```
- //
- // #### Common fixes
- //
- // If the value being assigned is always assignable at runtime, even though
- // the static types don't reflect that, then add an explicit cast.
- //
- // Otherwise, change the value being assigned so that it has the expected
- // type. In the previous example, this might look like:
- //
- // ```dart
- // int i = 0;
- // String s = i.toString();
- // ```
- //
- // If you can’t change the value, then change the type of the variable to be
- // compatible with the type of the value being assigned:
- //
- // ```dart
- // int i = 0;
- // int s = i;
- // ```
- static const StaticTypeWarningCode INVALID_ASSIGNMENT = StaticTypeWarningCode(
- 'INVALID_ASSIGNMENT',
- "A value of type '{0}' can't be assigned to a variable of type "
- "'{1}'.",
- correction: "Try changing the type of the variable, or "
- "casting the right-hand type to '{1}'.",
- hasPublishedDocs: true);
-
- /**
- * Parameters:
- * 0: the name of the identifier that is not a function type
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when it finds a function invocation,
- // but the name of the function being invoked is defined to be something other
- // than a function.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because `Binary` is the name of
- // a function type, not a function:
- //
- // ```dart
- // typedef Binary = int Function(int, int);
- //
- // int f() {
- // return [!Binary!](1, 2);
- // }
- // ```
- //
- // #### Common fixes
- //
- // Replace the name with the name of a function.
- static const StaticTypeWarningCode INVOCATION_OF_NON_FUNCTION =
- StaticTypeWarningCode(
- 'INVOCATION_OF_NON_FUNCTION', "'{0}' isn't a function.",
- // TODO(brianwilkerson) Split this error code so that we can provide
- // better error and correction messages.
- correction:
- "Try correcting the name to match an existing function, or "
- "define a method or function named '{0}'.",
- hasPublishedDocs: true);
-
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a function invocation is found,
- // but the name being referenced isn't the name of a function, or when the
- // expression computing the function doesn't compute a function.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because `x` isn't a function:
- //
- // ```dart
- // int x = 0;
- //
- // int f() => x;
- //
- // var y = [!x!]();
- // ```
- //
- // The following code produces this diagnostic because `f()` doesn't return a
- // function:
- //
- // ```dart
- // int x = 0;
- //
- // int f() => x;
- //
- // var y = [!f()!]();
- // ```
- //
- // #### Common fixes
- //
- // If you need to invoke a function, then replace the code before the argument
- // list with the name of a function or with an expression that computes a
- // function:
- //
- // ```dart
- // int x = 0;
- //
- // int f() => x;
- //
- // var y = f();
- // ```
- static const StaticTypeWarningCode INVOCATION_OF_NON_FUNCTION_EXPRESSION =
- StaticTypeWarningCode(
- 'INVOCATION_OF_NON_FUNCTION_EXPRESSION',
- "The expression doesn't evaluate to a function, so it can't be "
- "invoked.",
- hasPublishedDocs: true);
-
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a condition, such as an `if` or
- // `while` loop, doesn't have the static type `bool`.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because `x` has the static type
- // `int`:
- //
- // ```dart
- // void f(int x) {
- // if ([!x!]) {
- // // ...
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // Change the condition so that it produces a Boolean value:
- //
- // ```dart
- // void f(int x) {
- // if (x == 0) {
- // // ...
- // }
- // }
- // ```
- static const StaticTypeWarningCode NON_BOOL_CONDITION = StaticTypeWarningCode(
- 'NON_BOOL_CONDITION', "Conditions must have a static type of 'bool'.",
- correction: "Try changing the condition.", hasPublishedDocs: true);
-
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the first expression in an
- // assert has a type other than `bool`.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because the type of `p` is
- // `int`, but a `bool` is required:
- //
- // ```dart
- // void f(int p) {
- // assert([!p!]);
- // }
- // ```
- //
- // #### Common fixes
- //
- // Change the expression so that it has the type `bool`:
- //
- // ```dart
- // void f(int p) {
- // assert(p > 0);
- // }
- // ```
- static const StaticTypeWarningCode NON_BOOL_EXPRESSION =
- StaticTypeWarningCode('NON_BOOL_EXPRESSION',
- "The expression in an assert must be of type 'bool'.",
- correction: "Try changing the expression.", hasPublishedDocs: true);
-
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the operand of the unary
- // negation operator (`!`) doesn't have the type `bool`.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because `x` is an `int` when it
- // must be a `bool`:
- //
- // ```dart
- // int x = 0;
- // bool y = ![!x!];
- // ```
- //
- // #### Common fixes
- //
- // Replace the operand with an expression that has the type `bool`:
- //
- // ```dart
- // int x = 0;
- // bool y = !(x > 0);
- // ```
- static const StaticTypeWarningCode NON_BOOL_NEGATION_EXPRESSION =
- StaticTypeWarningCode('NON_BOOL_NEGATION_EXPRESSION',
- "A negation operand must have a static type of 'bool'.",
- correction: "Try changing the operand to the '!' operator.",
- hasPublishedDocs: true);
-
- /**
- * Parameters:
- * 0: the lexeme of the logical operator
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when one of the operands of either
- // the `&&` or `||` operator doesn't have the type `bool`.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because `a` isn't a Boolean
- // value:
- //
- // ```dart
- // int a = 3;
- // bool b = [!a!] || a > 1;
- // ```
- //
- // #### Common fixes
- //
- // Change the operand to a Boolean value:
- //
- // ```dart
- // int a = 3;
- // bool b = a == 0 || a > 1;
- // ```
- static const StaticTypeWarningCode NON_BOOL_OPERAND = StaticTypeWarningCode(
- 'NON_BOOL_OPERAND',
- "The operands of the operator '{0}' must be assignable to 'bool'.",
- hasPublishedDocs: true);
-
- /**
- * Parameters:
- * 0: the name appearing where a type is expected
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an identifier that isn't a type
- // is used as a type argument.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because `x` is a variable, not
- // a type:
- //
- // ```dart
- // var x = 0;
- // List<[!x!]> xList = [];
- // ```
- //
- // #### Common fixes
- //
- // Change the type argument to be a type:
- //
- // ```dart
- // var x = 0;
- // List xList = [];
- // ```
- static const StaticTypeWarningCode NON_TYPE_AS_TYPE_ARGUMENT =
- StaticTypeWarningCode('NON_TYPE_AS_TYPE_ARGUMENT',
- "The name '{0}' isn't a type so it can't be used as a type argument.",
- correction: "Try correcting the name to an existing type, or "
- "defining a type named '{0}'.",
- hasPublishedDocs: true,
- isUnresolvedIdentifier: true);
-
- /**
- * Parameters:
- * 0: the return type as declared in the return statement
- * 1: the expected return type as defined by the method
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when the static type of a returned
- // expression isn't assignable to the return type that the closure is required
- // to have.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because `f` is defined to be a
- // function that returns a `String`, but the closure assigned to it returns an
- // `int`:
- //
- // ```dart
- // String Function(String) f = (s) => [!3!];
- // ```
- //
- // #### Common fixes
- //
- // If the return type is correct, then replace the returned value with a value
- // of the correct type, possibly by converting the existing value:
- //
- // ```dart
- // String Function(String) f = (s) => 3.toString();
- // ```
- static const StaticTypeWarningCode RETURN_OF_INVALID_TYPE_FROM_CLOSURE =
- StaticTypeWarningCode(
- 'RETURN_OF_INVALID_TYPE_FROM_CLOSURE',
- "The return type '{0}' isn't a '{1}', as required by the closure's "
- "context.",
- hasPublishedDocs: true);
-
- /**
- * Parameters:
- * 0: the return type as declared in the return statement
- * 1: the expected return type as defined by the enclosing class
- * 2: the name of the constructor
- */
- static const StaticTypeWarningCode RETURN_OF_INVALID_TYPE_FROM_CONSTRUCTOR =
- StaticTypeWarningCodeWithUniqueName(
- 'RETURN_OF_INVALID_TYPE',
- 'StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_CONSTRUCTOR',
- "A value of type '{0}' can't be returned from constructor '{2}' "
- "because it has a return type of '{1}'.",
- hasPublishedDocs: true);
-
- /**
- * Parameters:
- * 0: the return type as declared in the return statement
- * 1: the expected return type as defined by the method
- * 2: the name of the method
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a method or function returns a
- // value whose type isn't assignable to the declared return type.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because `f` has a return type
- // of `String` but is returning an `int`:
- //
- // ```dart
- // String f() => [!3!];
- // ```
- //
- // #### Common fixes
- //
- // If the return type is correct, then replace the value being returned with a
- // value of the correct type, possibly by converting the existing value:
- //
- // ```dart
- // String f() => 3.toString();
- // ```
- //
- // If the value is correct, then change the return type to match:
- //
- // ```dart
- // int f() => 3;
- // ```
- static const StaticTypeWarningCode RETURN_OF_INVALID_TYPE_FROM_FUNCTION =
- StaticTypeWarningCodeWithUniqueName(
- 'RETURN_OF_INVALID_TYPE',
- 'StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION',
- "A value of type '{0}' can't be returned from function '{2}' because "
- "it has a return type of '{1}'.",
- hasPublishedDocs: true);
-
- /**
- * Parameters:
- * 0: the return type as declared in the return statement
- * 1: the expected return type as defined by the method
- * 2: the name of the method
- */
- static const StaticTypeWarningCode RETURN_OF_INVALID_TYPE_FROM_METHOD =
- StaticTypeWarningCodeWithUniqueName(
- 'RETURN_OF_INVALID_TYPE',
- 'StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_METHOD',
- "A value of type '{0}' can't be returned from method '{2}' because "
- "it has a return type of '{1}'.",
- hasPublishedDocs: true);
-
- /**
- * 10 Generics: It is a static type warning if a type parameter is a supertype
- * of its upper bound.
- *
- * Parameters:
- * 0: the name of the type parameter
- * 1: the name of the bounding type
- *
- * See [CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS].
- */
- static const StaticTypeWarningCode TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND =
- StaticTypeWarningCode('TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND',
- "'{0}' can't be a supertype of its upper bound.",
- correction: "Try using a type that is or is a subclass of '{1}'.");
-
- /**
- * Parameters:
- * 0: the name of the enumeration constant that is not defined
- * 1: the name of the enumeration used to access the constant
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when it encounters an identifier that
- // appears to be the name of an enum constant, and the name either isn't
- // defined or isn't visible in the scope in which it's being referenced.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because `E` doesn't define a
- // constant named `c`:
- //
- // ```dart
- // enum E {a, b}
- //
- // var e = E.[!c!];
- // ```
- //
- // #### Common fixes
- //
- // If the constant should be defined, then add it to the declaration of the
- // enum:
- //
- // ```dart
- // enum E {a, b, c}
- //
- // var e = E.c;
- // ```
- //
- // If the constant shouldn't be defined, then change the name to the name of
- // an existing constant:
- //
- // ```dart
- // enum E {a, b}
- //
- // var e = E.b;
- // ```
- static const StaticTypeWarningCode UNDEFINED_ENUM_CONSTANT =
- StaticTypeWarningCode('UNDEFINED_ENUM_CONSTANT',
- "There's no constant named '{0}' in '{1}'.",
- correction:
- "Try correcting the name to the name of an existing constant, or "
- "defining a constant named '{0}'.",
- hasPublishedDocs: true);
-
- /**
- * Parameters:
- * 0: the name of the method that is undefined
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when it encounters an identifier that
- // appears to be the name of a function but either isn't defined or isn't
- // visible in the scope in which it's being referenced.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because the name `emty` isn't
- // defined:
- //
- // ```dart
- // List empty() => [];
- //
- // void main() {
- // print([!emty!]());
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the identifier isn't defined, then either define it or replace it with
- // the name of a function that is defined. The example above can be corrected
- // by fixing the spelling of the function:
- //
- // ```dart
- // List empty() => [];
- //
- // void main() {
- // print(empty());
- // }
- // ```
- //
- // If the function is defined but isn't visible, then you probably need to add
- // an import or re-arrange your code to make the function visible.
- static const StaticTypeWarningCode UNDEFINED_FUNCTION = StaticTypeWarningCode(
- 'UNDEFINED_FUNCTION', "The function '{0}' isn't defined.",
- correction: "Try importing the library that defines '{0}', "
- "correcting the name to the name of an existing function, or "
- "defining a function named '{0}'.",
- hasPublishedDocs: true,
- isUnresolvedIdentifier: true);
-
- /**
- * Parameters:
- * 0: the name of the getter
- * 1: the name of the enclosing type where the getter is being looked for
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when it encounters an identifier that
- // appears to be the name of a getter but either isn't defined or isn't
- // visible in the scope in which it's being referenced.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because `String` has no member
- // named `len`:
- //
- // ```dart
- // int f(String s) => s.[!len!];
- // ```
- //
- // #### Common fixes
- //
- // If the identifier isn't defined, then either define it or replace it with
- // the name of a getter that is defined. The example above can be corrected by
- // fixing the spelling of the getter:
- //
- // ```dart
- // int f(String s) => s.length;
- // ```
- static const StaticTypeWarningCode UNDEFINED_GETTER = StaticTypeWarningCode(
- 'UNDEFINED_GETTER', "The getter '{0}' isn't defined for the type '{1}'.",
- correction: "Try importing the library that defines '{0}', "
- "correcting the name to the name of an existing getter, or "
- "defining a getter or field named '{0}'.",
- hasPublishedDocs: true);
-
- /**
- * Parameters:
- * 0: the name of the method that is undefined
- * 1: the resolved type name that the method lookup is happening on
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when it encounters an identifier that
- // appears to be the name of a method but either isn't defined or isn't
- // visible in the scope in which it's being referenced.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because the identifier
- // `removeMiddle` isn't defined:
- //
- // ```dart
- // int f(List l) => l.[!removeMiddle!]();
- // ```
- //
- // #### Common fixes
- //
- // If the identifier isn't defined, then either define it or replace it with
- // the name of a method that is defined. The example above can be corrected by
- // fixing the spelling of the method:
- //
- // ```dart
- // int f(List l) => l.removeLast();
- // ```
- static const StaticTypeWarningCode UNDEFINED_METHOD = StaticTypeWarningCode(
- 'UNDEFINED_METHOD', "The method '{0}' isn't defined for the type '{1}'.",
- correction:
- "Try correcting the name to the name of an existing method, or "
- "defining a method named '{0}'.",
- hasPublishedDocs: true);
-
- /**
- * Parameters:
- * 0: the name of the operator
- * 1: the name of the enclosing type where the operator is being looked for
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a user-definable operator is
- // invoked on an object for which the operator isn't defined.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because the class `C` doesn't
- // define the operator `+`:
- //
- // ```dart
- // class C {}
- //
- // C f(C c) => c [!+!] 2;
- // ```
- //
- // #### Common fixes
- //
- // If the operator should be defined for the class, then define it:
- //
- // ```dart
- // class C {
- // C operator +(int i) => this;
- // }
- //
- // C f(C c) => c + 2;
- // ```
- static const StaticTypeWarningCode UNDEFINED_OPERATOR = StaticTypeWarningCode(
- 'UNDEFINED_OPERATOR',
- "The operator '{0}' isn't defined for the type '{1}'.",
- correction: "Try defining the operator '{0}'.",
- hasPublishedDocs: true);
-
- /**
- * No parameters.
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a prefixed identifier is found
- // where the prefix is valid, but the identifier isn't declared in any of the
- // libraries imported using that prefix.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because `dart:core` doesn't
- // define anything named `a`:
- //
- // ```dart
- // import 'dart:core' as p;
- //
- // void f() {
- // p.[!a!];
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the library in which the name is declared isn't imported yet, add an
- // import for the library.
- //
- // If the name is wrong, then change it to one of the names that's declared in
- // the imported libraries.
- static const StaticTypeWarningCode UNDEFINED_PREFIXED_NAME =
- StaticTypeWarningCode(
- 'UNDEFINED_PREFIXED_NAME',
- "The name '{0}' is being referenced through the prefix '{1}', but it "
- "isn't defined in any of the libraries imported using that "
- "prefix.",
- correction: "Try correcting the prefix or "
- "importing the library that defines '{0}'.",
- hasPublishedDocs: true);
-
- /**
- * Parameters:
- * 0: the name of the setter
- * 1: the name of the enclosing type where the setter is being looked for
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when it encounters an identifier that
- // appears to be the name of a setter but either isn't defined or isn't
- // visible in the scope in which the identifier is being referenced.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because there isn't a setter
- // named `z`:
- //
- // ```dart
- // class C {
- // int x = 0;
- // void m(int y) {
- // this.[!z!] = y;
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the identifier isn't defined, then either define it or replace it with
- // the name of a setter that is defined. The example above can be corrected by
- // fixing the spelling of the setter:
- //
- // ```dart
- // class C {
- // int x = 0;
- // void m(int y) {
- // this.x = y;
- // }
- // }
- // ```
- static const StaticTypeWarningCode UNDEFINED_SETTER = StaticTypeWarningCode(
- 'UNDEFINED_SETTER', "The setter '{0}' isn't defined for the type '{1}'.",
- correction: "Try importing the library that defines '{0}', "
- "correcting the name to the name of an existing setter, or "
- "defining a setter or field named '{0}'.",
- hasPublishedDocs: true);
-
- /**
- * 12.17 Getter Invocation: Let T be the static type of e. It is
- * a static type warning if T does not have a getter named m.
- *
- * Parameters:
- * 0: the name of the getter
- * 1: the name of the enclosing type where the getter is being looked for
- */
- static const StaticTypeWarningCode UNDEFINED_SUPER_GETTER =
- StaticTypeWarningCode('UNDEFINED_SUPER_GETTER',
- "The getter '{0}' isn't defined in a superclass of '{1}'.",
- correction:
- "Try correcting the name to the name of an existing getter, or "
- "defining a getter or field named '{0}' in a superclass.");
-
- /**
- * Parameters:
- * 0: the name of the method that is undefined
- * 1: the resolved type name that the method lookup is happening on
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when an inherited method is
- // referenced using `super`, but there’s no method with that name in the
- // superclass chain.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because `Object` doesn't define
- // a member named `n`:
- //
- // ```dart
- // class C {
- // void m() {
- // super.[!n!]();
- // }
- // }
- // ```
- //
- // #### Common fixes
- //
- // If the inherited method you intend to invoke has a different name, then
- // make the name of the invoked method match the inherited method.
- //
- // If the method you intend to invoke is defined in the same class, then
- // remove the `super.`.
- //
- // If not, then either add the method to one of the superclasses or remove the
- // invocation.
- static const StaticTypeWarningCode UNDEFINED_SUPER_METHOD =
- StaticTypeWarningCode('UNDEFINED_SUPER_METHOD',
- "The method '{0}' isn't defined in a superclass of '{1}'.",
- correction:
- "Try correcting the name to the name of an existing method, or "
- "defining a method named '{0}' in a superclass.",
- hasPublishedDocs: true);
-
- /**
- * 12.18 Assignment: Evaluation of an assignment of the form
- * e1[e2] = e3 is
- * equivalent to the evaluation of the expression (a, i, e){a.[]=(i, e);
- * return e;} (e1, e2,
- * e2).
- *
- * 12.29 Assignable Expressions: An assignable expression of the form
- * e1[e2] is evaluated as a method
- * invocation of the operator method [] on e1 with argument
- * e2.
- *
- * 12.15.1 Ordinary Invocation: Let T be the static type of o.
- * It is a static type warning if T does not have an accessible
- * instance member named m.
- *
- * Parameters:
- * 0: the name of the operator
- * 1: the name of the enclosing type where the operator is being looked for
- */
- static const StaticTypeWarningCode UNDEFINED_SUPER_OPERATOR =
- StaticTypeWarningCode('UNDEFINED_SUPER_OPERATOR',
- "The operator '{0}' isn't defined in a superclass of '{1}'.",
- correction: "Try defining the operator '{0}' in a superclass.");
-
- /**
- * 12.18 Assignment: Let T be the static type of e1.
- * It is a static type warning if T does not have an accessible
- * instance setter named v=.
- *
- * Parameters:
- * 0: the name of the setter
- * 1: the name of the enclosing type where the setter is being looked for
- */
- static const StaticTypeWarningCode UNDEFINED_SUPER_SETTER =
- StaticTypeWarningCode('UNDEFINED_SUPER_SETTER',
- "The setter '{0}' isn't defined in a superclass of '{1}'.",
- correction:
- "Try correcting the name to the name of an existing setter, or "
- "defining a setter or field named '{0}' in a superclass.");
-
- /**
- * 12.15.1 Ordinary Invocation: It is a static type warning if T does
- * not have an accessible (3.2) instance member named m.
- *
- * This is a specialization of [INSTANCE_ACCESS_TO_STATIC_MEMBER] that is used
- * when we are able to find the name defined in a supertype. It exists to
- * provide a more informative error message.
- *
- * Parameters:
- * 0: the name of the defining type
- */
- static const StaticTypeWarningCode
- UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER = StaticTypeWarningCode(
- 'UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER',
- "Static members from supertypes must be qualified by the name of the "
- "defining type.",
- correction: "Try adding '{0}.' before the name.");
-
- /**
- * Parameters:
- * 0: the name of the type being referenced (G)
- * 1: the number of type parameters that were declared
- * 2: the number of type arguments provided
- */
- // #### Description
- //
- // The analyzer produces this diagnostic when a type that has type parameters
- // is used and type arguments are provided, but the number of type arguments
- // isn't the same as the number of type parameters.
- //
- // The analyzer also produces this diagnostic when a constructor is invoked
- // and the number of type arguments doesn't match the number of type
- // parameters declared for the class.
- //
- // #### Examples
- //
- // The following code produces this diagnostic because `C` has one type
- // parameter but two type arguments are provided when it is used as a type
- // annotation:
- //
- // ```dart
- // class C {}
- //
- // void f([!C!] x) {}
- // ```
- //
- // The following code produces this diagnostic because `C` declares one type
- // parameter, but two type arguments are provided when creating an instance:
- //
- // ```dart
- // class C {}
- //
- // var c = [!C!]();
- // ```
- //
- // #### Common fixes
- //
- // Add or remove type arguments, as necessary, to match the number of type
- // parameters defined for the type:
- //
- // ```dart
- // class C {}
- //
- // void f(C x) {}
- // ```
- static const StaticTypeWarningCode WRONG_NUMBER_OF_TYPE_ARGUMENTS =
- StaticTypeWarningCode(
- 'WRONG_NUMBER_OF_TYPE_ARGUMENTS',
- "The type '{0}' is declared with {1} type parameters, "
- "but {2} type arguments were given.",
- correction:
- "Try adjusting the number of type arguments to match the number "
- "of type parameters.",
- hasPublishedDocs: true);
-
- /**
- * It will be a static type warning if m is not a generic method with
- * exactly n type parameters.
- *
- * Parameters:
- * 0: the name of the class being instantiated
- * 1: the name of the constructor being invoked
- */
- static const StaticTypeWarningCode
- WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR = StaticTypeWarningCode(
- 'WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR',
- "The constructor '{0}.{1}' doesn't have type parameters.",
- correction: "Try moving type arguments to after the type name.");
-
- /**
- * It will be a static type warning if m is not a generic method with
- * exactly n type parameters.
- *
- * Parameters:
- * 0: the name of the method being referenced (G)
- * 1: the number of type parameters that were declared
- * 2: the number of type arguments provided
- */
- static const StaticTypeWarningCode WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD =
- StaticTypeWarningCode(
- 'WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD',
- "The method '{0}' is declared with {1} type parameters, "
- "but {2} type arguments were given.",
- correction: "Try adjusting the number of type arguments.");
-
- /**
- * 17.16.1 Yield: Let T be the static type of e [the expression to the right
- * of "yield"] and let f be the immediately enclosing function. It is a
- * static type warning if either:
- *
- * - the body of f is marked async* and the type Stream may not be
- * assigned to the declared return type of f.
- *
- * - the body of f is marked sync* and the type Iterable may not be
- * assigned to the declared return type of f.
- *
- * 17.16.2 Yield-Each: Let T be the static type of e [the expression to the
- * right of "yield*"] and let f be the immediately enclosing function. It is
- * a static type warning if T may not be assigned to the declared return type
- * of f. If f is synchronous it is a static type warning if T may not be
- * assigned to Iterable. If f is asynchronous it is a static type warning if
- * T may not be assigned to Stream.
- */
- static const StaticTypeWarningCode YIELD_OF_INVALID_TYPE =
- StaticTypeWarningCode(
- 'YIELD_OF_INVALID_TYPE',
- "The type '{0}' implied by the 'yield' expression must be assignable "
- "to '{1}'.");
-
- /**
- * Initialize a newly created error code to have the given [name]. The message
- * associated with the error will be created from the given [message]
- * template. The correction associated with the error will be created from the
- * given [correction] template.
- */
- const StaticTypeWarningCode(String name, String message,
- {String correction,
- bool hasPublishedDocs,
- bool isUnresolvedIdentifier = false})
- : super.temporary(name, message,
- correction: correction,
- hasPublishedDocs: hasPublishedDocs,
- isUnresolvedIdentifier: isUnresolvedIdentifier);
-
- @override
- ErrorSeverity get errorSeverity => ErrorSeverity.ERROR;
-
- @override
- ErrorType get type => ErrorType.STATIC_TYPE_WARNING;
-}
-
-class StaticTypeWarningCodeWithUniqueName extends StaticTypeWarningCode {
- @override
- final String uniqueName;
-
- const StaticTypeWarningCodeWithUniqueName(
- String name, this.uniqueName, String message,
- {String correction, bool hasPublishedDocs})
- : super(name, message,
- correction: correction, hasPublishedDocs: hasPublishedDocs);
-}
-
/**
* The error codes used for static warnings. The convention for this class is
* for the name of the error code to indicate the problem that caused the error
diff --git a/pkg/analyzer/lib/src/error/return_type_verifier.dart b/pkg/analyzer/lib/src/error/return_type_verifier.dart
index 5e0ee73a78f..9d78748e903 100644
--- a/pkg/analyzer/lib/src/error/return_type_verifier.dart
+++ b/pkg/analyzer/lib/src/error/return_type_verifier.dart
@@ -119,7 +119,7 @@ class ReturnTypeVerifier {
} else {
checkElement(
_typeProvider.futureElement,
- StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE,
+ CompileTimeErrorCode.ILLEGAL_ASYNC_RETURN_TYPE,
);
}
} else if (enclosingExecutable.isGenerator) {
@@ -157,25 +157,25 @@ class ReturnTypeVerifier {
void reportTypeError() {
if (enclosingExecutable.isClosure) {
_errorReporter.reportErrorForNode(
- StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE,
+ CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE,
expression,
[S, T],
);
} else if (enclosingExecutable.isConstructor) {
_errorReporter.reportErrorForNode(
- StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_CONSTRUCTOR,
+ CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_CONSTRUCTOR,
expression,
[S, T, enclosingExecutable.displayName],
);
} else if (enclosingExecutable.isFunction) {
_errorReporter.reportErrorForNode(
- StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION,
+ CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION,
expression,
[S, T, enclosingExecutable.displayName],
);
} else if (enclosingExecutable.isMethod) {
_errorReporter.reportErrorForNode(
- StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_METHOD,
+ CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_METHOD,
expression,
[S, T, enclosingExecutable.displayName],
);
@@ -258,25 +258,25 @@ class ReturnTypeVerifier {
void reportTypeError() {
if (enclosingExecutable.isClosure) {
_errorReporter.reportErrorForNode(
- StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE,
+ CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE,
expression,
[S, T],
);
} else if (enclosingExecutable.isConstructor) {
_errorReporter.reportErrorForNode(
- StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_CONSTRUCTOR,
+ CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_CONSTRUCTOR,
expression,
[S, T, enclosingExecutable.displayName],
);
} else if (enclosingExecutable.isFunction) {
_errorReporter.reportErrorForNode(
- StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION,
+ CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION,
expression,
[S, T, enclosingExecutable.displayName],
);
} else if (enclosingExecutable.isMethod) {
_errorReporter.reportErrorForNode(
- StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_METHOD,
+ CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_METHOD,
expression,
[S, T, enclosingExecutable.displayName],
);
diff --git a/pkg/analyzer/lib/src/error/type_arguments_verifier.dart b/pkg/analyzer/lib/src/error/type_arguments_verifier.dart
index ed3f577524d..ed0cec87e44 100644
--- a/pkg/analyzer/lib/src/error/type_arguments_verifier.dart
+++ b/pkg/analyzer/lib/src/error/type_arguments_verifier.dart
@@ -48,7 +48,7 @@ class TypeArgumentsVerifier {
);
}
_checkTypeArgumentCount(typeArguments, 1,
- StaticTypeWarningCode.EXPECTED_ONE_LIST_TYPE_ARGUMENTS);
+ CompileTimeErrorCode.EXPECTED_ONE_LIST_TYPE_ARGUMENTS);
}
_checkForImplicitDynamicTypedLiteral(node);
}
@@ -63,7 +63,7 @@ class TypeArgumentsVerifier {
);
}
_checkTypeArgumentCount(typeArguments, 2,
- StaticTypeWarningCode.EXPECTED_TWO_MAP_TYPE_ARGUMENTS);
+ CompileTimeErrorCode.EXPECTED_TWO_MAP_TYPE_ARGUMENTS);
}
_checkForImplicitDynamicTypedLiteral(node);
}
@@ -83,7 +83,7 @@ class TypeArgumentsVerifier {
);
}
_checkTypeArgumentCount(typeArguments, 1,
- StaticTypeWarningCode.EXPECTED_ONE_SET_TYPE_ARGUMENTS);
+ CompileTimeErrorCode.EXPECTED_ONE_SET_TYPE_ARGUMENTS);
}
_checkForImplicitDynamicTypedLiteral(node);
}
diff --git a/pkg/analyzer/lib/src/fasta/error_converter.dart b/pkg/analyzer/lib/src/fasta/error_converter.dart
index 16646b8ec59..2fd3549d7c5 100644
--- a/pkg/analyzer/lib/src/fasta/error_converter.dart
+++ b/pkg/analyzer/lib/src/fasta/error_converter.dart
@@ -130,7 +130,7 @@ class FastaErrorReporter {
var type1 = arguments['type'];
var type2 = arguments['type2'];
errorReporter?.reportErrorForOffset(
- StaticTypeWarningCode.INVALID_ASSIGNMENT,
+ CompileTimeErrorCode.INVALID_ASSIGNMENT,
offset,
length,
[type1, type2]);
@@ -288,15 +288,15 @@ class FastaErrorReporter {
return;
case "UNDEFINED_GETTER":
errorReporter?.reportErrorForOffset(
- StaticTypeWarningCode.UNDEFINED_GETTER, offset, length);
+ CompileTimeErrorCode.UNDEFINED_GETTER, offset, length);
return;
case "UNDEFINED_METHOD":
errorReporter?.reportErrorForOffset(
- StaticTypeWarningCode.UNDEFINED_METHOD, offset, length);
+ CompileTimeErrorCode.UNDEFINED_METHOD, offset, length);
return;
case "UNDEFINED_SETTER":
errorReporter?.reportErrorForOffset(
- StaticTypeWarningCode.UNDEFINED_SETTER, offset, length);
+ CompileTimeErrorCode.UNDEFINED_SETTER, offset, length);
return;
case "UNEXPECTED_DOLLAR_IN_STRING":
errorReporter?.reportErrorForOffset(
@@ -322,7 +322,7 @@ class FastaErrorReporter {
return;
case "WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR":
errorReporter?.reportErrorMessage(
- StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
+ CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
offset,
length,
message);
diff --git a/pkg/analyzer/lib/src/generated/element_resolver.dart b/pkg/analyzer/lib/src/generated/element_resolver.dart
index 7b6a003c0d9..e36b41b0327 100644
--- a/pkg/analyzer/lib/src/generated/element_resolver.dart
+++ b/pkg/analyzer/lib/src/generated/element_resolver.dart
@@ -521,7 +521,7 @@ class ElementResolver extends SimpleAstVisitor {
[identifier.name]);
} else {
_errorReporter.reportErrorForNode(
- StaticTypeWarningCode.UNDEFINED_PREFIXED_NAME,
+ CompileTimeErrorCode.UNDEFINED_PREFIXED_NAME,
identifier,
[identifier.name, prefixElement.name]);
}
@@ -851,7 +851,7 @@ class ElementResolver extends SimpleAstVisitor {
}
/// Check that the given index [expression] was resolved, otherwise a
- /// [StaticTypeWarningCode.UNDEFINED_OPERATOR] is generated. The [target] is
+ /// [CompileTimeErrorCode.UNDEFINED_OPERATOR] is generated. The [target] is
/// the target of the expression. The [methodName] is the name of the operator
/// associated with the context of using of the given index expression.
void _checkForUndefinedIndexOperator(
@@ -886,7 +886,7 @@ class ElementResolver extends SimpleAstVisitor {
);
} else if (target is SuperExpression) {
_errorReporter.reportErrorForOffset(
- StaticTypeWarningCode.UNDEFINED_SUPER_OPERATOR,
+ CompileTimeErrorCode.UNDEFINED_SUPER_OPERATOR,
offset,
length,
[methodName, staticType],
@@ -904,7 +904,7 @@ class ElementResolver extends SimpleAstVisitor {
);
} else {
_errorReporter.reportErrorForOffset(
- StaticTypeWarningCode.UNDEFINED_OPERATOR,
+ CompileTimeErrorCode.UNDEFINED_OPERATOR,
offset,
length,
[methodName, staticType],
@@ -1320,8 +1320,8 @@ class ElementResolver extends SimpleAstVisitor {
_checkForStaticAccessToInstanceMember(propertyName, element);
} else {
var code = typeReference.isEnum
- ? StaticTypeWarningCode.UNDEFINED_ENUM_CONSTANT
- : StaticTypeWarningCode.UNDEFINED_GETTER;
+ ? CompileTimeErrorCode.UNDEFINED_ENUM_CONSTANT
+ : CompileTimeErrorCode.UNDEFINED_GETTER;
_errorReporter.reportErrorForNode(
code,
propertyName,
@@ -1356,7 +1356,7 @@ class ElementResolver extends SimpleAstVisitor {
// The error will be reported in ErrorVerifier.
} else {
_errorReporter.reportErrorForNode(
- StaticTypeWarningCode.UNDEFINED_SETTER,
+ CompileTimeErrorCode.UNDEFINED_SETTER,
propertyName,
[propertyName.name, typeReference.name],
);
@@ -1392,7 +1392,7 @@ class ElementResolver extends SimpleAstVisitor {
);
} else {
_errorReporter.reportErrorForNode(
- StaticTypeWarningCode.UNDEFINED_SUPER_GETTER,
+ CompileTimeErrorCode.UNDEFINED_SUPER_GETTER,
propertyName,
[propertyName.name, staticType],
);
@@ -1433,7 +1433,7 @@ class ElementResolver extends SimpleAstVisitor {
}
} else {
_errorReporter.reportErrorForNode(
- StaticTypeWarningCode.UNDEFINED_SUPER_SETTER,
+ CompileTimeErrorCode.UNDEFINED_SUPER_SETTER,
propertyName,
[propertyName.name, staticType],
);
@@ -1494,7 +1494,7 @@ class ElementResolver extends SimpleAstVisitor {
}
if (shouldReportUndefinedGetter) {
_errorReporter.reportErrorForNode(
- StaticTypeWarningCode.UNDEFINED_GETTER,
+ CompileTimeErrorCode.UNDEFINED_GETTER,
propertyName,
[propertyName.name, staticType],
);
@@ -1517,7 +1517,7 @@ class ElementResolver extends SimpleAstVisitor {
// OK
} else {
_errorReporter.reportErrorForNode(
- StaticTypeWarningCode.UNDEFINED_SETTER,
+ CompileTimeErrorCode.UNDEFINED_SETTER,
propertyName,
[propertyName.name, staticType],
);
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index 5821ce0da8b..320d81b9d95 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -711,7 +711,7 @@ class ErrorVerifier extends RecursiveAstVisitor {
node.staticElement == null &&
!_isFunctionType(expressionType)) {
_errorReporter.reportErrorForNode(
- StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION,
+ CompileTimeErrorCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION,
functionExpression);
} else if (expressionType is FunctionType) {
_typeArgumentsVerifier.checkFunctionExpressionInvocation(node);
@@ -2241,7 +2241,7 @@ class ErrorVerifier extends RecursiveAstVisitor {
if (!_typeSystem.isAssignableTo2(iterableType, requiredSequenceType)) {
_errorReporter.reportErrorForNode(
- StaticTypeWarningCode.FOR_IN_OF_INVALID_TYPE,
+ CompileTimeErrorCode.FOR_IN_OF_INVALID_TYPE,
node.iterable,
[iterableType, loopTypeName],
);
@@ -2265,7 +2265,7 @@ class ErrorVerifier extends RecursiveAstVisitor {
if (!_typeSystem.isAssignableTo2(sequenceElementType, variableType)) {
_errorReporter.reportErrorForNode(
- StaticTypeWarningCode.FOR_IN_OF_INVALID_ELEMENT_TYPE,
+ CompileTimeErrorCode.FOR_IN_OF_INVALID_ELEMENT_TYPE,
node.iterable,
[iterableType, loopTypeName, variableType],
);
@@ -2765,7 +2765,7 @@ class ErrorVerifier extends RecursiveAstVisitor {
/// Check that the given [typeReference] is not a type reference and that then
/// the [name] is reference to an instance member.
///
- /// See [StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER].
+ /// See [CompileTimeErrorCode.INSTANCE_ACCESS_TO_STATIC_MEMBER].
void _checkForInstanceAccessToStaticMember(
ClassElement typeReference, Expression target, SimpleIdentifier name) {
if (_isInComment) {
@@ -2802,7 +2802,7 @@ class ErrorVerifier extends RecursiveAstVisitor {
}
}
_errorReporter.reportErrorForNode(
- StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER,
+ CompileTimeErrorCode.INSTANCE_ACCESS_TO_STATIC_MEMBER,
name,
[name.name, _getKind(element), element.enclosingElement.name]);
}
@@ -2838,7 +2838,7 @@ class ErrorVerifier extends RecursiveAstVisitor {
/// Verify that the given left hand side ([lhs]) and right hand side ([rhs])
/// represent a valid assignment.
///
- /// See [StaticTypeWarningCode.INVALID_ASSIGNMENT].
+ /// See [CompileTimeErrorCode.INVALID_ASSIGNMENT].
void _checkForInvalidAssignment(Expression lhs, Expression rhs) {
if (lhs == null || rhs == null) {
return;
@@ -2863,7 +2863,7 @@ class ErrorVerifier extends RecursiveAstVisitor {
}
_checkForAssignableExpression(
- rhs, leftType, StaticTypeWarningCode.INVALID_ASSIGNMENT);
+ rhs, leftType, CompileTimeErrorCode.INVALID_ASSIGNMENT);
}
/// Check the given [initializer] to ensure that the field being initialized
@@ -4051,7 +4051,7 @@ class ErrorVerifier extends RecursiveAstVisitor {
/// Check that none of the type [parameters] references itself in its bound.
///
- /// See [StaticTypeWarningCode.TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND].
+ /// See [CompileTimeErrorCode.TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND].
void _checkForTypeParameterBoundRecursion(List parameters) {
Map elementToNode;
for (var parameter in parameters) {
@@ -4074,7 +4074,7 @@ class ErrorVerifier extends RecursiveAstVisitor {
if (step == parameters.length) {
var element = parameter.declaredElement;
_errorReporter.reportErrorForNode(
- StaticTypeWarningCode.TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND,
+ CompileTimeErrorCode.TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND,
parameter,
[element.displayName, element.bound],
);
@@ -4256,7 +4256,7 @@ class ErrorVerifier extends RecursiveAstVisitor {
/// defined in the enclosing class rather than in a superclass.
///
/// See
- /// [StaticTypeWarningCode.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER].
+ /// [CompileTimeErrorCode.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER].
void _checkForUnqualifiedReferenceToNonLocalStaticMember(
SimpleIdentifier name) {
Element element = name.staticElement;
@@ -4289,7 +4289,7 @@ class ErrorVerifier extends RecursiveAstVisitor {
[enclosingElement.displayName]);
} else {
_errorReporter.reportErrorForNode(
- StaticTypeWarningCode
+ CompileTimeErrorCode
.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER,
name,
[enclosingElement.displayName]);
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index b57f4fe12ee..49cc989b5c5 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -616,7 +616,7 @@ class ResolverVisitor extends ScopedVisitor {
node.condition?.accept(this);
boolExpressionVerifier.checkForNonBoolExpression(
node.condition,
- errorCode: StaticTypeWarningCode.NON_BOOL_EXPRESSION,
+ errorCode: CompileTimeErrorCode.NON_BOOL_EXPRESSION,
);
_flowAnalysis?.flow?.assert_afterCondition(node.condition);
node.message?.accept(this);
@@ -630,7 +630,7 @@ class ResolverVisitor extends ScopedVisitor {
node.condition?.accept(this);
boolExpressionVerifier.checkForNonBoolExpression(
node.condition,
- errorCode: StaticTypeWarningCode.NON_BOOL_EXPRESSION,
+ errorCode: CompileTimeErrorCode.NON_BOOL_EXPRESSION,
);
_flowAnalysis?.flow?.assert_afterCondition(node.condition);
node.message?.accept(this);
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 0d43ce30232..5c5928d65c0 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
@@ -334,7 +334,7 @@ class A {
}
var v = const A();
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 45, 5),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 45, 5),
error(
CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH,
64,
@@ -404,7 +404,7 @@ const int y = 1;
var v = const C();
''',
[
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 27, 1),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 27, 1),
error(
CheckedModeCompileTimeErrorCode
.CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH,
@@ -437,7 +437,7 @@ const int y = 1;
var v = const C();
''',
[
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 27, 1),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 27, 1),
],
);
}
@@ -620,7 +620,7 @@ const Unresolved x = null;
const int x = 'foo';
''', [
error(CheckedModeCompileTimeErrorCode.VARIABLE_TYPE_MISMATCH, 14, 5),
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 14, 5),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 14, 5),
]);
}
diff --git a/pkg/analyzer/test/generated/compile_time_error_code.dart b/pkg/analyzer/test/generated/compile_time_error_code.dart
index 8afcd5b8007..425ac7d7e7d 100644
--- a/pkg/analyzer/test/generated/compile_time_error_code.dart
+++ b/pkg/analyzer/test/generated/compile_time_error_code.dart
@@ -246,7 +246,7 @@ const int i = (1 ? 'alpha' : 'beta').length;
''', [
error(CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE, 14,
29),
- error(StaticTypeWarningCode.NON_BOOL_CONDITION, 15, 1),
+ error(CompileTimeErrorCode.NON_BOOL_CONDITION, 15, 1),
error(CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL, 15, 1),
]);
}
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 b77cbfd572e..478487e588d 100644
--- a/pkg/analyzer/test/generated/compile_time_error_code_test.dart
+++ b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
@@ -51,7 +51,7 @@ f() {
}
''', [
error(HintCode.UNUSED_LOCAL_VARIABLE, 17, 1),
- error(StaticTypeWarningCode.NON_BOOL_CONDITION, 24, 1),
+ error(CompileTimeErrorCode.NON_BOOL_CONDITION, 24, 1),
]);
}
@@ -63,7 +63,7 @@ f() {
for (i = 0; 3;) {}
}''', [
error(HintCode.UNUSED_LOCAL_VARIABLE, 12, 1),
- error(StaticTypeWarningCode.NON_BOOL_CONDITION, 29, 1),
+ error(CompileTimeErrorCode.NON_BOOL_CONDITION, 29, 1),
]);
}
diff --git a/pkg/analyzer/test/generated/error_suppression_test.dart b/pkg/analyzer/test/generated/error_suppression_test.dart
index 877c7132e2b..233595144fd 100644
--- a/pkg/analyzer/test/generated/error_suppression_test.dart
+++ b/pkg/analyzer/test/generated/error_suppression_test.dart
@@ -22,7 +22,7 @@ class ErrorSuppressionTest extends DriverResolutionTest with PackageMixin {
await assertErrorsInCode('''
int x = ''; // ignore: invalid_assignment
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 8, 2),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 8, 2),
]);
}
@@ -31,7 +31,7 @@ int x = ''; // ignore: invalid_assignment
// ignore: unused_import, undefined_function
f() => g();
''', [
- error(StaticTypeWarningCode.UNDEFINED_FUNCTION, 52, 1),
+ error(CompileTimeErrorCode.UNDEFINED_FUNCTION, 52, 1),
]);
}
@@ -41,7 +41,7 @@ f() => g();
int x = '';
int _y = 0; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 34, 2),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 34, 2),
error(HintCode.UNUSED_ELEMENT, 42, 2),
]);
}
@@ -139,7 +139,7 @@ int x = (0 as int); // ignore: UNNECESSARY_CAST
int x = '';
const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 43, 2),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 43, 2),
error(CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE, 57,
1),
]);
@@ -153,7 +153,7 @@ const String y = x; //INVALID_ASSIGNMENT, CONST_INITIALIZED_WITH_NON_CONSTANT_VA
''', [
error(CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE, 43,
1),
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 43, 1),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 43, 1),
]);
}
@@ -162,7 +162,7 @@ const String y = x; //INVALID_ASSIGNMENT, CONST_INITIALIZED_WITH_NON_CONSTANT_VA
// ignore invalid_assignment
String y = 3; //INVALID_ASSIGNMENT
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 40, 1),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 40, 1),
]);
}
@@ -228,7 +228,7 @@ int _y = x as int; //UNNECESSARY_CAST, UNUSED_ELEMENT
int x = ''; //INVALID_ASSIGNMENT
const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 8, 2),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 8, 2),
error(CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE, 43,
1),
]);
@@ -260,7 +260,7 @@ f() => g();
'''
f() => g();
''',
- [error(StaticTypeWarningCode.UNDEFINED_FUNCTION, 7, 1)],
+ [error(CompileTimeErrorCode.UNDEFINED_FUNCTION, 7, 1)],
);
}
diff --git a/pkg/analyzer/test/generated/non_error_resolver_test.dart b/pkg/analyzer/test/generated/non_error_resolver_test.dart
index 4527bd688c8..286187a8639 100644
--- a/pkg/analyzer/test/generated/non_error_resolver_test.dart
+++ b/pkg/analyzer/test/generated/non_error_resolver_test.dart
@@ -2181,7 +2181,7 @@ void main() {
}
''', [
error(HintCode.UNUSED_LOCAL_VARIABLE, 93, 1),
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 97, 1),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 97, 1),
]);
var z = result.unit.declaredElement.topLevelVariables
.where((e) => e.name == 'z')
@@ -2796,8 +2796,8 @@ main() {
null[0];
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_METHOD, 0, 0),
- error(StaticTypeWarningCode.UNDEFINED_METHOD, 0, 0),
+ error(CompileTimeErrorCode.UNDEFINED_METHOD, 0, 0),
+ error(CompileTimeErrorCode.UNDEFINED_METHOD, 0, 0),
]);
}
diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart
index 61362bfaf79..9423c6ca76b 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -6880,7 +6880,7 @@ mixin ExpressionParserTestMixin implements AbstractParserTestCase {
InstanceCreationExpressionImpl expression =
parseExpression('new a.b.c()', errors: [
expectedError(
- StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
+ CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
8,
1)
]);
@@ -15153,7 +15153,7 @@ main() {
}
var statement = parseStatement('const A.c();') as ExpressionStatement;
assertErrorsWithCodes(
- [StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR]);
+ [CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR]);
expect(statement.expression, isNotNull);
}
diff --git a/pkg/analyzer/test/generated/resolver_test.dart b/pkg/analyzer/test/generated/resolver_test.dart
index 16902a4d53f..bc21731949c 100644
--- a/pkg/analyzer/test/generated/resolver_test.dart
+++ b/pkg/analyzer/test/generated/resolver_test.dart
@@ -314,7 +314,7 @@ int f(num n) {
assert (n is int);
return n & 0x0F;
}''', [
- error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 47, 1),
+ error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 47, 1),
]);
}
@@ -337,7 +337,7 @@ int f(num n) {
int f(num n) {
return (n is! int) ? 0 : n & 0x0F;
}''', [
- error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 44, 1),
+ error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 44, 1),
]);
}
@@ -346,7 +346,7 @@ int f(num n) {
int f(num n) {
return (n is! int || n < 0) ? 0 : n & 0x0F;
}''', [
- error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 53, 1),
+ error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 53, 1),
]);
}
@@ -373,7 +373,7 @@ int f(List list) {
}''', [
error(HintCode.MISSING_RETURN, 4, 1),
error(HintCode.UNUSED_LOCAL_VARIABLE, 30, 3),
- error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 76, 1),
+ error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 76, 1),
]);
}
@@ -406,7 +406,7 @@ int f(num n) {
return n & 0x0F;
}
}''', [
- error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 72, 1),
+ error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 72, 1),
]);
}
@@ -418,7 +418,7 @@ int f(num n) {
}
return n & 0x0F;
}''', [
- error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 63, 1),
+ error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 63, 1),
]);
}
@@ -431,7 +431,7 @@ int f(num n) {
return n & 0x0F;
}
}''', [
- error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 81, 1),
+ error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 81, 1),
]);
}
@@ -441,7 +441,7 @@ int f() {
num n = 1234;
return n & 0x0F;
}''', [
- error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 37, 1),
+ error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 37, 1),
]);
}
}
diff --git a/pkg/analyzer/test/generated/simple_resolver_test.dart b/pkg/analyzer/test/generated/simple_resolver_test.dart
index 4ff5151a3f3..09bb7307293 100644
--- a/pkg/analyzer/test/generated/simple_resolver_test.dart
+++ b/pkg/analyzer/test/generated/simple_resolver_test.dart
@@ -786,7 +786,7 @@ f() {
List> b;
b[0][0] = 'hi';
}''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 39, 4),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 39, 4),
]);
verifyTestResolved();
}
diff --git a/pkg/analyzer/test/generated/static_type_warning_code_test.dart b/pkg/analyzer/test/generated/static_type_warning_code_test.dart
index d0ad450f6f7..14674c4651f 100644
--- a/pkg/analyzer/test/generated/static_type_warning_code_test.dart
+++ b/pkg/analyzer/test/generated/static_type_warning_code_test.dart
@@ -34,7 +34,7 @@ f(Object x) {
}
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_METHOD, 65, 3),
+ error(CompileTimeErrorCode.UNDEFINED_METHOD, 65, 3),
]);
}
@@ -59,7 +59,7 @@ f() async {
}
''', [
error(HintCode.UNUSED_LOCAL_VARIABLE, 68, 1),
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 72, 10),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 72, 10),
]);
}
@@ -84,7 +84,7 @@ f() async {
}
''', [
error(HintCode.UNUSED_LOCAL_VARIABLE, 75, 1),
- error(StaticTypeWarningCode.FOR_IN_OF_INVALID_ELEMENT_TYPE, 80, 6),
+ error(CompileTimeErrorCode.FOR_IN_OF_INVALID_ELEMENT_TYPE, 80, 6),
]);
}
@@ -135,7 +135,7 @@ f() async {
}
''', [
error(HintCode.UNUSED_LOCAL_VARIABLE, 64, 1),
- error(StaticTypeWarningCode.FOR_IN_OF_INVALID_ELEMENT_TYPE, 85, 6),
+ error(CompileTimeErrorCode.FOR_IN_OF_INVALID_ELEMENT_TYPE, 85, 6),
]);
}
@@ -185,8 +185,8 @@ void main() {
}
''', [
error(HintCode.UNUSED_LOCAL_VARIABLE, 271, 4),
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 289, 2),
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 304, 2),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 289, 2),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 304, 2),
]);
}
@@ -207,7 +207,7 @@ f() {
}
''', [
error(HintCode.UNUSED_LOCAL_VARIABLE, 17, 1),
- error(StaticTypeWarningCode.FOR_IN_OF_INVALID_ELEMENT_TYPE, 22, 10),
+ error(CompileTimeErrorCode.FOR_IN_OF_INVALID_ELEMENT_TYPE, 22, 10),
]);
}
@@ -272,7 +272,7 @@ f() {
}
''', [
error(HintCode.UNUSED_LOCAL_VARIABLE, 12, 1),
- error(StaticTypeWarningCode.FOR_IN_OF_INVALID_ELEMENT_TYPE, 27, 10),
+ error(CompileTimeErrorCode.FOR_IN_OF_INVALID_ELEMENT_TYPE, 27, 10),
]);
}
@@ -306,7 +306,7 @@ class Foo> {
}
''', [
error(HintCode.UNUSED_LOCAL_VARIABLE, 81, 1),
- error(StaticTypeWarningCode.FOR_IN_OF_INVALID_ELEMENT_TYPE, 86, 8),
+ error(CompileTimeErrorCode.FOR_IN_OF_INVALID_ELEMENT_TYPE, 86, 8),
]);
}
@@ -344,7 +344,7 @@ main(Object p) {
p = 0;
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_GETTER, 71, 6),
+ error(CompileTimeErrorCode.UNDEFINED_GETTER, 71, 6),
]);
}
@@ -354,7 +354,7 @@ main(Object p) {
((p is String) && ((p = 42) == 42)) && p.length != 0;
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_GETTER, 60, 6),
+ error(CompileTimeErrorCode.UNDEFINED_GETTER, 60, 6),
]);
}
@@ -364,7 +364,7 @@ main(Object p) {
(p is String) && (((p = 42) == 42) && p.length != 0);
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_GETTER, 59, 6),
+ error(CompileTimeErrorCode.UNDEFINED_GETTER, 59, 6),
]);
}
@@ -376,7 +376,7 @@ main(Object p) {
p = 42;
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_GETTER, 68, 6),
+ error(CompileTimeErrorCode.UNDEFINED_GETTER, 68, 6),
]);
}
@@ -388,7 +388,7 @@ main(Object p) {
p is String ? callMe(() { p.length; }) : 0;
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_GETTER, 78, 6),
+ error(CompileTimeErrorCode.UNDEFINED_GETTER, 78, 6),
]);
}
@@ -398,7 +398,7 @@ main(Object p) {
p is String ? (p.length + (p = 42)) : 0;
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_GETTER, 36, 6),
+ error(CompileTimeErrorCode.UNDEFINED_GETTER, 36, 6),
]);
}
@@ -414,7 +414,7 @@ main(Object p) {
p = 0;
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_GETTER, 83, 6),
+ error(CompileTimeErrorCode.UNDEFINED_GETTER, 83, 6),
]);
}
@@ -426,7 +426,7 @@ main(Object p) {
}
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_GETTER, 66, 6),
+ error(CompileTimeErrorCode.UNDEFINED_GETTER, 66, 6),
]);
}
@@ -444,7 +444,7 @@ main(A p) {
}
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_GETTER, 100, 1),
+ error(CompileTimeErrorCode.UNDEFINED_GETTER, 100, 1),
]);
}
@@ -462,7 +462,7 @@ main(A p) {
}
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_GETTER, 105, 1),
+ error(CompileTimeErrorCode.UNDEFINED_GETTER, 105, 1),
]);
}
@@ -475,7 +475,7 @@ main(Object p) {
}
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_GETTER, 44, 6),
+ error(CompileTimeErrorCode.UNDEFINED_GETTER, 44, 6),
]);
}
@@ -488,7 +488,7 @@ main(Object p) {
}
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_GETTER, 55, 6),
+ error(CompileTimeErrorCode.UNDEFINED_GETTER, 55, 6),
]);
}
@@ -501,7 +501,7 @@ main(Object p) {
() {p = 0;};
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_GETTER, 44, 6),
+ error(CompileTimeErrorCode.UNDEFINED_GETTER, 44, 6),
]);
}
@@ -514,7 +514,7 @@ main(Object p) {
}
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_GETTER, 59, 6),
+ error(CompileTimeErrorCode.UNDEFINED_GETTER, 59, 6),
]);
}
@@ -527,7 +527,7 @@ main(Object p) {
f() {p = 0;};
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_GETTER, 44, 6),
+ error(CompileTimeErrorCode.UNDEFINED_GETTER, 44, 6),
error(HintCode.UNUSED_ELEMENT, 58, 1),
]);
}
@@ -542,7 +542,7 @@ main(Object p) {
}
''', [
error(HintCode.UNUSED_ELEMENT, 19, 1),
- error(StaticTypeWarningCode.UNDEFINED_GETTER, 60, 6),
+ error(CompileTimeErrorCode.UNDEFINED_GETTER, 60, 6),
]);
}
@@ -560,7 +560,7 @@ main(A p) {
}
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_GETTER, 103, 1),
+ error(CompileTimeErrorCode.UNDEFINED_GETTER, 103, 1),
]);
}
@@ -578,7 +578,7 @@ main(A p) {
}
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_GETTER, 112, 1),
+ error(CompileTimeErrorCode.UNDEFINED_GETTER, 112, 1),
]);
}
@@ -591,7 +591,7 @@ main(A a) {
a.element.anyGetterExistsInDynamic;
}
''', [
- error(StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT, 35, 10),
+ error(CompileTimeErrorCode.NON_TYPE_AS_TYPE_ARGUMENT, 35, 10),
]);
}
}
diff --git a/pkg/analyzer/test/generated/strong_mode_test.dart b/pkg/analyzer/test/generated/strong_mode_test.dart
index 6504efa4084..efa2a44b227 100644
--- a/pkg/analyzer/test/generated/strong_mode_test.dart
+++ b/pkg/analyzer/test/generated/strong_mode_test.dart
@@ -912,7 +912,7 @@ class StrongModeLocalInferenceTest extends ResolverTestCase {
// Test that FutureOr does not have the constituent type methods
MethodInvocation invoke = await _testFutureOr(r'''
dynamic test(FutureOr x) => x.abs();
- ''', errors: [StaticTypeWarningCode.UNDEFINED_METHOD]);
+ ''', errors: [CompileTimeErrorCode.UNDEFINED_METHOD]);
_isDynamic(invoke.staticType);
}
@@ -920,7 +920,7 @@ class StrongModeLocalInferenceTest extends ResolverTestCase {
// Test that FutureOr does not have the Future type methods
MethodInvocation invoke = await _testFutureOr(r'''
dynamic test(FutureOr x) => x.then((x) => x);
- ''', errors: [StaticTypeWarningCode.UNDEFINED_METHOD]);
+ ''', errors: [CompileTimeErrorCode.UNDEFINED_METHOD]);
_isDynamic(invoke.staticType);
}
@@ -928,7 +928,7 @@ class StrongModeLocalInferenceTest extends ResolverTestCase {
// Test that FutureOr does not have all methods
MethodInvocation invoke = await _testFutureOr(r'''
dynamic test(FutureOr x) => x.abs();
- ''', errors: [StaticTypeWarningCode.UNDEFINED_METHOD]);
+ ''', errors: [CompileTimeErrorCode.UNDEFINED_METHOD]);
_isDynamic(invoke.staticType);
}
@@ -3667,7 +3667,7 @@ void main() {
test_returnOfInvalidType_object_void() async {
await assertErrorsInCode(
"Object f() { void voidFn() => null; return voidFn(); }", [
- error(StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 43, 8),
+ error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 43, 8),
]);
}
@@ -3702,7 +3702,7 @@ class A {
}
set g(int x) => 42;
''', [
- error(StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 41, 4),
+ error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 41, 4),
]);
}
diff --git a/pkg/analyzer/test/source/error_processor_test.dart b/pkg/analyzer/test/source/error_processor_test.dart
index f3e548d004f..2a58d77bb25 100644
--- a/pkg/analyzer/test/source/error_processor_test.dart
+++ b/pkg/analyzer/test/source/error_processor_test.dart
@@ -19,7 +19,7 @@ import '../src/util/yaml_test.dart';
main() {
AnalysisError invalid_assignment = AnalysisError(
- TestSource(), 0, 1, StaticTypeWarningCode.INVALID_ASSIGNMENT, [
+ TestSource(), 0, 1, CompileTimeErrorCode.INVALID_ASSIGNMENT, [
['x'],
['y']
]);
diff --git a/pkg/analyzer/test/src/dart/analysis/driver_test.dart b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
index 031f9e31403..2f46907c073 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
@@ -1666,7 +1666,7 @@ String z = "string";
ResolvedUnitResult result = await driver.getResult(b);
List errors = result.errors;
expect(errors, hasLength(1));
- expect(errors[0].errorCode, StaticTypeWarningCode.INVALID_ASSIGNMENT);
+ expect(errors[0].errorCode, CompileTimeErrorCode.INVALID_ASSIGNMENT);
}
}
diff --git a/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart b/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart
index 00533932705..eb8b1081ae4 100644
--- a/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart
+++ b/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart
@@ -152,7 +152,7 @@ analyzer:
num a = 0;
int b = a;
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 19, 1),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 19, 1),
]);
}
@@ -167,7 +167,7 @@ analyzer:
num a = 0;
int b = a;
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 19, 1),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 19, 1),
]);
}
@@ -184,7 +184,7 @@ analyzer:
num a = 0;
int b = a;
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 19, 1),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 19, 1),
]);
}
@@ -383,7 +383,7 @@ analyzer:
num a = 0;
int b = a;
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 19, 1),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 19, 1),
]);
// Implicit casts are enabled in 'bbb'.
@@ -398,7 +398,7 @@ int b = a;
num a = 0;
int b = a;
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 19, 1),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 19, 1),
]);
}
diff --git a/pkg/analyzer/test/src/dart/resolution/assignment_test.dart b/pkg/analyzer/test/src/dart/resolution/assignment_test.dart
index 531f4b16ba7..4b8a3975329 100644
--- a/pkg/analyzer/test/src/dart/resolution/assignment_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/assignment_test.dart
@@ -153,10 +153,10 @@ main(int i) {
i %= 1.2;
}
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 21, 3),
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 33, 3),
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 45, 3),
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 57, 3),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 21, 3),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 33, 3),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 45, 3),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 57, 3),
]);
assertType(findNode.assignment('+='), 'double');
assertType(findNode.assignment('-='), 'double');
@@ -187,7 +187,7 @@ main(double a, int b) {
a ??= b;
}
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 32, 1),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 32, 1),
]);
assertType(findNode.assignment('??='), 'num');
}
diff --git a/pkg/analyzer/test/src/dart/resolution/ast_rewrite_test.dart b/pkg/analyzer/test/src/dart/resolution/ast_rewrite_test.dart
index d8216d2ac0b..9bb15816a0f 100644
--- a/pkg/analyzer/test/src/dart/resolution/ast_rewrite_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/ast_rewrite_test.dart
@@ -138,7 +138,7 @@ f() {
prefix.A.named(0);
}
''', [
- error(StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
+ error(CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
50, 5),
]);
@@ -220,7 +220,7 @@ f() {
A.named(0);
}
''', [
- error(StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
+ error(CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
52, 13),
]);
diff --git a/pkg/analyzer/test/src/dart/resolution/class_test.dart b/pkg/analyzer/test/src/dart/resolution/class_test.dart
index 891e684364b..3b4f1a2d0e1 100644
--- a/pkg/analyzer/test/src/dart/resolution/class_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/class_test.dart
@@ -681,7 +681,7 @@ class B extends A {
}
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_SUPER_GETTER, 58, 1),
+ error(CompileTimeErrorCode.UNDEFINED_SUPER_GETTER, 58, 1),
]);
}
@@ -694,7 +694,7 @@ class B extends A {
}
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_SUPER_METHOD, 56, 1),
+ error(CompileTimeErrorCode.UNDEFINED_SUPER_METHOD, 56, 1),
]);
}
@@ -707,7 +707,7 @@ class B extends A {
}
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_SUPER_OPERATOR, 70, 1),
+ error(CompileTimeErrorCode.UNDEFINED_SUPER_OPERATOR, 70, 1),
]);
}
@@ -720,8 +720,8 @@ class B extends A {
}
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_SUPER_OPERATOR, 70, 7),
- error(StaticTypeWarningCode.UNDEFINED_SUPER_OPERATOR, 70, 7),
+ error(CompileTimeErrorCode.UNDEFINED_SUPER_OPERATOR, 70, 7),
+ error(CompileTimeErrorCode.UNDEFINED_SUPER_OPERATOR, 70, 7),
]);
}
@@ -734,7 +734,7 @@ class B extends A {
}
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_SUPER_OPERATOR, 70, 11),
+ error(CompileTimeErrorCode.UNDEFINED_SUPER_OPERATOR, 70, 11),
]);
}
@@ -747,7 +747,7 @@ class B extends A {
}
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_SUPER_OPERATOR, 71, 7),
+ error(CompileTimeErrorCode.UNDEFINED_SUPER_OPERATOR, 71, 7),
]);
}
@@ -760,7 +760,7 @@ class B extends A {
}
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_SUPER_SETTER, 49, 1),
+ error(CompileTimeErrorCode.UNDEFINED_SUPER_SETTER, 49, 1),
]);
}
}
diff --git a/pkg/analyzer/test/src/dart/resolution/extension_method_test.dart b/pkg/analyzer/test/src/dart/resolution/extension_method_test.dart
index 191d6c2ae8e..b4414b368aa 100644
--- a/pkg/analyzer/test/src/dart/resolution/extension_method_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/extension_method_test.dart
@@ -149,7 +149,7 @@ f(C c) {
c.a;
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_GETTER, 40, 1),
+ error(CompileTimeErrorCode.UNDEFINED_GETTER, 40, 1),
]);
}
@@ -167,7 +167,7 @@ f(C c) {
c.a;
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_GETTER, 40, 1),
+ error(CompileTimeErrorCode.UNDEFINED_GETTER, 40, 1),
]);
}
diff --git a/pkg/analyzer/test/src/dart/resolution/generic_type_alias_test.dart b/pkg/analyzer/test/src/dart/resolution/generic_type_alias_test.dart
index 1ae8a7d7eb2..35e383a3049 100644
--- a/pkg/analyzer/test/src/dart/resolution/generic_type_alias_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/generic_type_alias_test.dart
@@ -122,7 +122,7 @@ void f() {
''', [
error(ParserErrorCode.INVALID_GENERIC_FUNCTION_TYPE, 13, 1),
error(ParserErrorCode.EXPECTED_TYPE_NAME, 15, 1),
- error(StaticTypeWarningCode.UNDEFINED_GETTER, 33, 1),
+ error(CompileTimeErrorCode.UNDEFINED_GETTER, 33, 1),
]);
}
@@ -137,7 +137,7 @@ void f() {
p.F.a;
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_GETTER, 40, 1),
+ error(CompileTimeErrorCode.UNDEFINED_GETTER, 40, 1),
]);
}
diff --git a/pkg/analyzer/test/src/dart/resolution/instance_creation_test.dart b/pkg/analyzer/test/src/dart/resolution/instance_creation_test.dart
index 509155901b8..85e42d9bd16 100644
--- a/pkg/analyzer/test/src/dart/resolution/instance_creation_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/instance_creation_test.dart
@@ -19,7 +19,7 @@ class InstanceCreationDriverResolutionTest extends DriverResolutionTest {
await assertErrorsInCode(r'''
final foo = Map();
''', [
- error(StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 12, 8),
+ error(CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 12, 8),
]);
var creation = findNode.instanceCreation('Map');
@@ -42,7 +42,7 @@ main() {
new Foo.bar();
}
''', [
- error(StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
+ error(CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
53, 5),
]);
@@ -70,7 +70,7 @@ main() {
new p.Foo.bar();
}
''', [
- error(StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
+ error(CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
44, 3),
]);
@@ -97,7 +97,7 @@ main() {
Foo.bar();
}
''', [
- error(StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
+ error(CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
49, 5),
]);
@@ -129,7 +129,7 @@ main() {
p.Foo.bar();
}
''', [
- error(StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
+ error(CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
43, 5),
]);
diff --git a/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart b/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart
index 35c029ee015..513338a4da5 100644
--- a/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart
@@ -78,7 +78,7 @@ main(A a) {
a.foo(0);
}
''', [
- error(StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER, 57, 3),
+ error(CompileTimeErrorCode.INSTANCE_ACCESS_TO_STATIC_MEMBER, 57, 3),
]);
assertMethodInvocation2(
findNode.methodInvocation('a.foo(0)'),
@@ -99,7 +99,7 @@ main(C c) {
c();
}
''', [
- error(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION, 51, 1),
+ error(CompileTimeErrorCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION, 51, 1),
]);
var invocation = findNode.functionExpressionInvocation('c();');
@@ -119,7 +119,7 @@ main() {
foo();
}
''', [
- error(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION, 25, 3),
+ error(CompileTimeErrorCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION, 25, 3),
]);
var invocation = findNode.functionExpressionInvocation('foo();');
@@ -265,7 +265,7 @@ main() {
C.foo();
}
''', [
- error(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION, 42, 5),
+ error(CompileTimeErrorCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION, 42, 5),
]);
var invocation = findNode.functionExpressionInvocation('foo();');
@@ -289,7 +289,7 @@ class C {
}
}
''', [
- error(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION, 46, 3),
+ error(CompileTimeErrorCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION, 46, 3),
]);
var invocation = findNode.functionExpressionInvocation('foo();');
@@ -314,7 +314,7 @@ class B extends A {
}
}
''', [
- error(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION, 68, 9),
+ error(CompileTimeErrorCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION, 68, 9),
]);
var invocation = findNode.functionExpressionInvocation('foo();');
@@ -401,7 +401,7 @@ main() {
foo(0);
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_FUNCTION, 11, 3),
+ error(CompileTimeErrorCode.UNDEFINED_FUNCTION, 11, 3),
]);
_assertUnresolvedMethodInvocation('foo(0)');
}
@@ -414,7 +414,7 @@ main() {
math.foo(0);
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_FUNCTION, 45, 3),
+ error(CompileTimeErrorCode.UNDEFINED_FUNCTION, 45, 3),
]);
_assertUnresolvedMethodInvocation('foo(0);');
}
@@ -437,7 +437,7 @@ main() {
C.foo(0);
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_METHOD, 24, 3),
+ error(CompileTimeErrorCode.UNDEFINED_METHOD, 24, 3),
]);
_assertUnresolvedMethodInvocation('foo(0);');
}
@@ -451,7 +451,7 @@ main() {
C.foo(x);
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_METHOD, 32, 3),
+ error(CompileTimeErrorCode.UNDEFINED_METHOD, 32, 3),
]);
_assertUnresolvedMethodInvocation('foo(x);');
@@ -470,7 +470,7 @@ main() {
C.foo(0);
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_METHOD, 76, 3),
+ error(CompileTimeErrorCode.UNDEFINED_METHOD, 76, 3),
]);
_assertUnresolvedMethodInvocation('foo(0);');
}
@@ -483,7 +483,7 @@ main() {
C.foo();
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_METHOD, 25, 3),
+ error(CompileTimeErrorCode.UNDEFINED_METHOD, 25, 3),
]);
_assertUnresolvedMethodInvocation(
@@ -499,7 +499,7 @@ class C {
static main() => C.T();
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_METHOD, 34, 1),
+ error(CompileTimeErrorCode.UNDEFINED_METHOD, 34, 1),
]);
_assertUnresolvedMethodInvocation('C.T();');
}
@@ -510,7 +510,7 @@ main() {
42.foo(0);
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_METHOD, 14, 3),
+ error(CompileTimeErrorCode.UNDEFINED_METHOD, 14, 3),
]);
_assertUnresolvedMethodInvocation('foo(0);');
}
@@ -522,7 +522,7 @@ main() {
v.foo(0);
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_METHOD, 30, 3),
+ error(CompileTimeErrorCode.UNDEFINED_METHOD, 30, 3),
]);
_assertUnresolvedMethodInvocation('foo(0);');
}
@@ -535,7 +535,7 @@ class C {
}
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_METHOD, 25, 3),
+ error(CompileTimeErrorCode.UNDEFINED_METHOD, 25, 3),
]);
_assertUnresolvedMethodInvocation('foo(0);');
}
@@ -546,7 +546,7 @@ main() {
null.foo();
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_METHOD, 16, 3),
+ error(CompileTimeErrorCode.UNDEFINED_METHOD, 16, 3),
]);
_assertUnresolvedMethodInvocation('foo();');
}
@@ -557,7 +557,7 @@ main(Object o) {
o.call();
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_METHOD, 21, 4),
+ error(CompileTimeErrorCode.UNDEFINED_METHOD, 21, 4),
]);
}
@@ -576,7 +576,7 @@ class B extends A {
}
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_METHOD, 53, 4),
+ error(CompileTimeErrorCode.UNDEFINED_METHOD, 53, 4),
]);
_assertUnresolvedMethodInvocation('_foo(0);');
}
@@ -591,7 +591,7 @@ main() {
C..foo();
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_METHOD, 50, 3),
+ error(CompileTimeErrorCode.UNDEFINED_METHOD, 50, 3),
]);
}
@@ -604,7 +604,7 @@ main() {
A?.toString();
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_METHOD, 25, 8),
+ error(CompileTimeErrorCode.UNDEFINED_METHOD, 25, 8),
]);
}
@@ -618,7 +618,7 @@ class B extends A {
}
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_SUPER_METHOD, 62, 3),
+ error(CompileTimeErrorCode.UNDEFINED_SUPER_METHOD, 62, 3),
]);
_assertUnresolvedMethodInvocation('foo(0);');
assertSuperExpression(findNode.super_('super.foo'));
@@ -637,7 +637,7 @@ class B extends A {
}
''', [
error(
- StaticTypeWarningCode
+ CompileTimeErrorCode
.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER,
71,
3),
@@ -830,7 +830,7 @@ main() {
foo();
}
''', [
- error(StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD, 29, 5),
+ error(CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD, 29, 5),
]);
assertMethodInvocation(
findNode.methodInvocation('foo()'),
@@ -848,7 +848,7 @@ main() {
foo();
}
''', [
- error(StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD, 58, 5),
+ error(CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD, 58, 5),
]);
assertMethodInvocation(
findNode.methodInvocation('foo()'),
@@ -1655,7 +1655,7 @@ main() {
}
''', [
error(
- StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD, 32, 13),
+ CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD, 32, 13),
]);
var invocation = findNode.methodInvocation('foo();');
assertTypeArgumentTypes(invocation, ['dynamic']);
@@ -1914,7 +1914,7 @@ main(A? a) {
}
''', [
error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 27, 1),
- error(StaticTypeWarningCode.UNDEFINED_METHOD, 29, 3),
+ error(CompileTimeErrorCode.UNDEFINED_METHOD, 29, 3),
]);
assertMethodInvocation2(
@@ -1939,7 +1939,7 @@ main(A? a) {
}
''', [
error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 65, 1),
- error(StaticTypeWarningCode.UNDEFINED_METHOD, 67, 3),
+ error(CompileTimeErrorCode.UNDEFINED_METHOD, 67, 3),
]);
assertMethodInvocation2(
diff --git a/pkg/analyzer/test/src/dart/resolution/mixin_test.dart b/pkg/analyzer/test/src/dart/resolution/mixin_test.dart
index 3732016a170..5fcc5b5d739 100644
--- a/pkg/analyzer/test/src/dart/resolution/mixin_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/mixin_test.dart
@@ -958,7 +958,7 @@ mixin M on A {
}
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_SUPER_METHOD, 52, 3),
+ error(CompileTimeErrorCode.UNDEFINED_SUPER_METHOD, 52, 3),
]);
var invocation = findNode.methodInvocation('foo(42)');
diff --git a/pkg/analyzer/test/src/dart/resolution/prefix_expression_test.dart b/pkg/analyzer/test/src/dart/resolution/prefix_expression_test.dart
index 14dd4c2f36f..d32b3cb7c51 100644
--- a/pkg/analyzer/test/src/dart/resolution/prefix_expression_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/prefix_expression_test.dart
@@ -64,7 +64,7 @@ f(int x) {
!x;
}
''', [
- error(StaticTypeWarningCode.NON_BOOL_NEGATION_EXPRESSION, 14, 1),
+ error(CompileTimeErrorCode.NON_BOOL_NEGATION_EXPRESSION, 14, 1),
]);
assertPrefixExpression(
diff --git a/pkg/analyzer/test/src/dart/resolution/prefixed_identifier_test.dart b/pkg/analyzer/test/src/dart/resolution/prefixed_identifier_test.dart
index 4288df4617f..9222211156a 100644
--- a/pkg/analyzer/test/src/dart/resolution/prefixed_identifier_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/prefixed_identifier_test.dart
@@ -102,7 +102,7 @@ int Function() foo() {
return a;
}
''', [
- error(StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 50, 1),
+ error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 50, 1),
]);
var identifier = findNode.simple('a;');
diff --git a/pkg/analyzer/test/src/dart/resolution/property_access_test.dart b/pkg/analyzer/test/src/dart/resolution/property_access_test.dart
index 1c626bd2921..b57b14ef6b2 100644
--- a/pkg/analyzer/test/src/dart/resolution/property_access_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/property_access_test.dart
@@ -51,7 +51,7 @@ int Function() foo() {
return B().a; // ref
}
''', [
- error(StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 85, 5),
+ error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 85, 5),
]);
var identifier = findNode.simple('a; // ref');
diff --git a/pkg/analyzer/test/src/dart/resolution/simple_identifier_test.dart b/pkg/analyzer/test/src/dart/resolution/simple_identifier_test.dart
index c62baebfe87..732f7b18e18 100644
--- a/pkg/analyzer/test/src/dart/resolution/simple_identifier_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/simple_identifier_test.dart
@@ -151,7 +151,7 @@ int Function() foo(A? a) {
return a;
}
''', [
- error(StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 68, 1),
+ error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 68, 1),
]);
var identifier = findNode.simple('a;');
diff --git a/pkg/analyzer/test/src/dart/resolution/type_inference/function_expression_test.dart b/pkg/analyzer/test/src/dart/resolution/type_inference/function_expression_test.dart
index 031d921ba12..84ca28f76c8 100644
--- a/pkg/analyzer/test/src/dart/resolution/type_inference/function_expression_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/type_inference/function_expression_test.dart
@@ -20,7 +20,7 @@ class FunctionExpressionTest extends DriverResolutionTest {
test_contextFunctionType_returnType_async_blockBody_futureOrVoid() async {
var expectedErrors = expectedErrorsByNullability(
nullable: [
- error(StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE, 72, 1),
+ error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE, 72, 1),
],
legacy: [],
);
@@ -43,7 +43,7 @@ FutureOr Function() v = () async {
test_contextFunctionType_returnType_async_blockBody_futureVoid() async {
var expectedErrors = expectedErrorsByNullability(
nullable: [
- error(StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE, 48, 1),
+ error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE, 48, 1),
],
legacy: [],
);
@@ -164,7 +164,7 @@ int Function() v = () {
test_contextFunctionType_returnType_sync_blockBody_void() async {
var expectedErrors = expectedErrorsByNullability(nullable: [
- error(StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE, 34, 1),
+ error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE, 34, 1),
], legacy: []);
await assertErrorsInCode('''
void Function() v = () {
diff --git a/pkg/analyzer/test/src/dart/resolution/type_inference/list_literal_test.dart b/pkg/analyzer/test/src/dart/resolution/type_inference/list_literal_test.dart
index 32c358a5401..53970afdf71 100644
--- a/pkg/analyzer/test/src/dart/resolution/type_inference/list_literal_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/type_inference/list_literal_test.dart
@@ -43,7 +43,7 @@ List a = [];
test_context_noTypeArgs_noElements_typeParameter() async {
var expectedErrors = expectedErrorsByNullability(
nullable: [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 39, 2),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 39, 2),
],
legacy: [
error(CompileTimeErrorCode.INVALID_CAST_LITERAL_LIST, 39, 2),
@@ -60,7 +60,7 @@ class A> {
test_context_noTypeArgs_noElements_typeParameter_dynamic() async {
var expectedErrors = expectedErrorsByNullability(
nullable: [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 43, 2),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 43, 2),
],
legacy: [
error(CompileTimeErrorCode.INVALID_CAST_LITERAL_LIST, 43, 2),
@@ -78,7 +78,7 @@ class A> {
await assertErrorsInCode('''
List a = [0];
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 17, 8),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 17, 8),
]);
assertType(findNode.listLiteral('['), 'List');
}
@@ -113,7 +113,7 @@ List a = ['a'];
await assertErrorsInCode('''
List a = [];
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 17, 7),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 17, 7),
]);
assertType(findNode.listLiteral('['), 'List');
}
diff --git a/pkg/analyzer/test/src/dart/resolution/type_inference/map_literal_test.dart b/pkg/analyzer/test/src/dart/resolution/type_inference/map_literal_test.dart
index c387ddf3e25..54c5c981658 100644
--- a/pkg/analyzer/test/src/dart/resolution/type_inference/map_literal_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/type_inference/map_literal_test.dart
@@ -66,7 +66,7 @@ Map a = {};
test_context_noTypeArgs_noEntries_typeParameters() async {
var expectedErrors = expectedErrorsByNullability(
nullable: [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 46, 2),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 46, 2),
],
legacy: [
error(CompileTimeErrorCode.INVALID_CAST_LITERAL_MAP, 46, 2),
@@ -83,7 +83,7 @@ class A> {
test_context_noTypeArgs_noEntries_typeParameters_dynamic() async {
var expectedErrors = expectedErrorsByNullability(
nullable: [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 51, 2),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 51, 2),
],
legacy: [
error(CompileTimeErrorCode.INVALID_CAST_LITERAL_MAP, 51, 2),
@@ -126,7 +126,7 @@ Map a = {'a' : 'b'};
await assertErrorsInCode('''
Map a = {};
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 24, 12),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 24, 12),
]);
assertType(setOrMapLiteral('{'), 'Map');
}
diff --git a/pkg/analyzer/test/src/dart/resolution/type_inference/set_literal_test.dart b/pkg/analyzer/test/src/dart/resolution/type_inference/set_literal_test.dart
index 9a25ca0d5f1..267717e83da 100644
--- a/pkg/analyzer/test/src/dart/resolution/type_inference/set_literal_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/type_inference/set_literal_test.dart
@@ -57,7 +57,7 @@ FutureOr> f() {
test_context_noTypeArgs_noElements_typeParameter() async {
var expectedErrors = expectedErrorsByNullability(
nullable: [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 38, 2),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 38, 2),
],
legacy: [
error(CompileTimeErrorCode.INVALID_CAST_LITERAL_SET, 38, 2),
@@ -74,7 +74,7 @@ class A> {
test_context_noTypeArgs_noElements_typeParameter_dynamic() async {
var expectedErrors = expectedErrorsByNullability(
nullable: [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 42, 2),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 42, 2),
],
legacy: [
error(CompileTimeErrorCode.INVALID_CAST_LITERAL_SET, 42, 2),
@@ -116,7 +116,7 @@ Set a = {'a'};
await assertErrorsInCode('''
Set a = {};
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 16, 7),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 16, 7),
]);
assertType(setLiteral('{'), 'Set');
}
diff --git a/pkg/analyzer/test/src/diagnostics/ambiguous_extension_member_access_test.dart b/pkg/analyzer/test/src/diagnostics/ambiguous_extension_member_access_test.dart
index dc9635c6e8e..a27736a57e2 100644
--- a/pkg/analyzer/test/src/diagnostics/ambiguous_extension_member_access_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/ambiguous_extension_member_access_test.dart
@@ -31,7 +31,7 @@ int f(A a) => a();
''', [
error(CompileTimeErrorCode.AMBIGUOUS_EXTENSION_MEMBER_ACCESS, 110, 1),
error(
- StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION, 110, 1),
+ CompileTimeErrorCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION, 110, 1),
]);
}
diff --git a/pkg/analyzer/test/src/diagnostics/assignment_to_method_test.dart b/pkg/analyzer/test/src/diagnostics/assignment_to_method_test.dart
index 3361f2379fb..ad89ea1bf36 100644
--- a/pkg/analyzer/test/src/diagnostics/assignment_to_method_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/assignment_to_method_test.dart
@@ -30,7 +30,7 @@ f(C c) {
}
''', [
error(CompileTimeErrorCode.ASSIGNMENT_TO_METHOD, 87, 5),
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 95, 1),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 95, 1),
]);
}
@@ -61,7 +61,7 @@ extension E on C {
}
''', [
error(CompileTimeErrorCode.ASSIGNMENT_TO_METHOD, 86, 8),
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 97, 1),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 97, 1),
]);
}
}
diff --git a/pkg/analyzer/test/src/diagnostics/const_eval_type_bool_test.dart b/pkg/analyzer/test/src/diagnostics/const_eval_type_bool_test.dart
index 711122d1096..085d6eec3c7 100644
--- a/pkg/analyzer/test/src/diagnostics/const_eval_type_bool_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/const_eval_type_bool_test.dart
@@ -20,7 +20,7 @@ class ConstEvalTypeBoolTest extends DriverResolutionTest {
const c = true && '';
''', [
error(CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL, 10, 10),
- error(StaticTypeWarningCode.NON_BOOL_OPERAND, 18, 2),
+ error(CompileTimeErrorCode.NON_BOOL_OPERAND, 18, 2),
]);
}
@@ -29,7 +29,7 @@ const c = true && '';
const c = (true || 0);
''', [
error(HintCode.DEAD_CODE, 19, 1),
- error(StaticTypeWarningCode.NON_BOOL_OPERAND, 19, 1),
+ error(CompileTimeErrorCode.NON_BOOL_OPERAND, 19, 1),
]);
}
@@ -38,7 +38,7 @@ const c = (true || 0);
const c = false || '';
''', [
error(CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL, 10, 11),
- error(StaticTypeWarningCode.NON_BOOL_OPERAND, 19, 2),
+ error(CompileTimeErrorCode.NON_BOOL_OPERAND, 19, 2),
]);
}
diff --git a/pkg/analyzer/test/src/diagnostics/expected_one_list_type_arguments_test.dart b/pkg/analyzer/test/src/diagnostics/expected_one_list_type_arguments_test.dart
index c5b3597820d..c478806b20c 100644
--- a/pkg/analyzer/test/src/diagnostics/expected_one_list_type_arguments_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/expected_one_list_type_arguments_test.dart
@@ -28,7 +28,7 @@ main() {
main() {
[];
}''', [
- error(StaticTypeWarningCode.EXPECTED_ONE_LIST_TYPE_ARGUMENTS, 11, 10),
+ error(CompileTimeErrorCode.EXPECTED_ONE_LIST_TYPE_ARGUMENTS, 11, 10),
]);
}
}
diff --git a/pkg/analyzer/test/src/diagnostics/expected_one_set_type_arguments_test.dart b/pkg/analyzer/test/src/diagnostics/expected_one_set_type_arguments_test.dart
index 890ca88262a..2192c2b3b7d 100644
--- a/pkg/analyzer/test/src/diagnostics/expected_one_set_type_arguments_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/expected_one_set_type_arguments_test.dart
@@ -20,7 +20,7 @@ class ExpectedOneSetTypeArgumentsTest extends DriverResolutionTest {
main() {
{2, 3};
}''', [
- error(StaticTypeWarningCode.EXPECTED_ONE_SET_TYPE_ARGUMENTS, 11, 15),
+ error(CompileTimeErrorCode.EXPECTED_ONE_SET_TYPE_ARGUMENTS, 11, 15),
]);
}
}
diff --git a/pkg/analyzer/test/src/diagnostics/expected_two_map_type_arguments_test.dart b/pkg/analyzer/test/src/diagnostics/expected_two_map_type_arguments_test.dart
index a8b297f5e49..5c1a8404fa0 100644
--- a/pkg/analyzer/test/src/diagnostics/expected_two_map_type_arguments_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/expected_two_map_type_arguments_test.dart
@@ -22,7 +22,7 @@ class ExpectedTwoMapTypeArgumentsTest extends DriverResolutionTest {
main() {
{};
}''', [
- error(StaticTypeWarningCode.EXPECTED_TWO_MAP_TYPE_ARGUMENTS, 11, 15),
+ error(CompileTimeErrorCode.EXPECTED_TWO_MAP_TYPE_ARGUMENTS, 11, 15),
]);
}
@@ -31,7 +31,7 @@ main() {
main() {
{1: 2};
}''', [
- error(StaticTypeWarningCode.EXPECTED_TWO_MAP_TYPE_ARGUMENTS, 11, 15),
+ error(CompileTimeErrorCode.EXPECTED_TWO_MAP_TYPE_ARGUMENTS, 11, 15),
]);
}
diff --git a/pkg/analyzer/test/src/diagnostics/for_in_of_invalid_element_type_test.dart b/pkg/analyzer/test/src/diagnostics/for_in_of_invalid_element_type_test.dart
index eb1ddf720fe..8824a62e86d 100644
--- a/pkg/analyzer/test/src/diagnostics/for_in_of_invalid_element_type_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/for_in_of_invalid_element_type_test.dart
@@ -24,7 +24,7 @@ f() async {
}
''', [
error(HintCode.UNUSED_LOCAL_VARIABLE, 75, 1),
- error(StaticTypeWarningCode.FOR_IN_OF_INVALID_ELEMENT_TYPE, 80, 6),
+ error(CompileTimeErrorCode.FOR_IN_OF_INVALID_ELEMENT_TYPE, 80, 6),
]);
}
@@ -38,7 +38,7 @@ f() async {
}
''', [
error(HintCode.UNUSED_LOCAL_VARIABLE, 64, 1),
- error(StaticTypeWarningCode.FOR_IN_OF_INVALID_ELEMENT_TYPE, 85, 6),
+ error(CompileTimeErrorCode.FOR_IN_OF_INVALID_ELEMENT_TYPE, 85, 6),
]);
}
@@ -51,7 +51,7 @@ class Foo> {
}
''', [
error(HintCode.UNUSED_LOCAL_VARIABLE, 81, 1),
- error(StaticTypeWarningCode.FOR_IN_OF_INVALID_ELEMENT_TYPE, 86, 8),
+ error(CompileTimeErrorCode.FOR_IN_OF_INVALID_ELEMENT_TYPE, 86, 8),
]);
}
@@ -62,7 +62,7 @@ f() {
}
''', [
error(HintCode.UNUSED_LOCAL_VARIABLE, 17, 1),
- error(StaticTypeWarningCode.FOR_IN_OF_INVALID_ELEMENT_TYPE, 22, 10),
+ error(CompileTimeErrorCode.FOR_IN_OF_INVALID_ELEMENT_TYPE, 22, 10),
]);
}
@@ -74,7 +74,7 @@ f() {
}
''', [
error(HintCode.UNUSED_LOCAL_VARIABLE, 12, 1),
- error(StaticTypeWarningCode.FOR_IN_OF_INVALID_ELEMENT_TYPE, 27, 10),
+ error(CompileTimeErrorCode.FOR_IN_OF_INVALID_ELEMENT_TYPE, 27, 10),
]);
}
}
diff --git a/pkg/analyzer/test/src/diagnostics/for_in_of_invalid_type_test.dart b/pkg/analyzer/test/src/diagnostics/for_in_of_invalid_type_test.dart
index a07d16bc758..00e6a70ae75 100644
--- a/pkg/analyzer/test/src/diagnostics/for_in_of_invalid_type_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/for_in_of_invalid_type_test.dart
@@ -35,7 +35,7 @@ f(bool e) async {
}
}
''', [
- error(StaticTypeWarningCode.FOR_IN_OF_INVALID_TYPE, 41, 1),
+ error(CompileTimeErrorCode.FOR_IN_OF_INVALID_TYPE, 41, 1),
]);
}
@@ -57,7 +57,7 @@ f(bool e) {
}
}
''', [
- error(StaticTypeWarningCode.FOR_IN_OF_INVALID_TYPE, 29, 1),
+ error(CompileTimeErrorCode.FOR_IN_OF_INVALID_TYPE, 29, 1),
]);
}
}
diff --git a/pkg/analyzer/test/src/diagnostics/illegal_async_return_type_test.dart b/pkg/analyzer/test/src/diagnostics/illegal_async_return_type_test.dart
index a5d8ce950af..55ed10e92b7 100644
--- a/pkg/analyzer/test/src/diagnostics/illegal_async_return_type_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/illegal_async_return_type_test.dart
@@ -19,7 +19,7 @@ class IllegalAsyncReturnTypeTest extends DriverResolutionTest {
await assertErrorsInCode('''
int f() async {}
''', [
- error(StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE, 0, 3),
+ error(CompileTimeErrorCode.ILLEGAL_ASYNC_RETURN_TYPE, 0, 3),
]);
}
@@ -35,7 +35,7 @@ int f() async {
return 2;
}
''', [
- error(StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE, 0, 3),
+ error(CompileTimeErrorCode.ILLEGAL_ASYNC_RETURN_TYPE, 0, 3),
]);
}
@@ -47,7 +47,7 @@ SubFuture f() async {
return 0;
}
''', [
- error(StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE, 73, 14),
+ error(CompileTimeErrorCode.ILLEGAL_ASYNC_RETURN_TYPE, 73, 14),
]);
}
@@ -57,7 +57,7 @@ class C {
int m() async {}
}
''', [
- error(StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE, 12, 3),
+ error(CompileTimeErrorCode.ILLEGAL_ASYNC_RETURN_TYPE, 12, 3),
]);
}
@@ -79,7 +79,7 @@ class C {
}
}
''', [
- error(StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE, 85, 14),
+ error(CompileTimeErrorCode.ILLEGAL_ASYNC_RETURN_TYPE, 85, 14),
]);
}
}
diff --git a/pkg/analyzer/test/src/diagnostics/instance_access_to_static_member_test.dart b/pkg/analyzer/test/src/diagnostics/instance_access_to_static_member_test.dart
index a409b21eadb..6eb6bef9538 100644
--- a/pkg/analyzer/test/src/diagnostics/instance_access_to_static_member_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/instance_access_to_static_member_test.dart
@@ -28,7 +28,7 @@ f(C c) {
g(c).a;
}
''', [
- error(StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER, 93, 1),
+ error(CompileTimeErrorCode.INSTANCE_ACCESS_TO_STATIC_MEMBER, 93, 1),
]);
assertElement(
findNode.simple('a;'),
@@ -48,7 +48,7 @@ f(C c) {
c.a();
}
''', [
- error(StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER, 68, 1),
+ error(CompileTimeErrorCode.INSTANCE_ACCESS_TO_STATIC_MEMBER, 68, 1),
]);
assertElement(
findNode.methodInvocation('a();'),
@@ -68,7 +68,7 @@ f(C c) {
c.a = 2;
}
''', [
- error(StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER, 68, 1),
+ error(CompileTimeErrorCode.INSTANCE_ACCESS_TO_STATIC_MEMBER, 68, 1),
]);
assertElement(
findNode.simple('a = 2;'),
@@ -85,7 +85,7 @@ main(A a) {
a.m;
}
''', [
- error(StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER, 44, 1),
+ error(CompileTimeErrorCode.INSTANCE_ACCESS_TO_STATIC_MEMBER, 44, 1),
]);
}
@@ -98,7 +98,7 @@ main(A a) {
a.f;
}
''', [
- error(StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER, 44, 1),
+ error(CompileTimeErrorCode.INSTANCE_ACCESS_TO_STATIC_MEMBER, 44, 1),
]);
}
@@ -111,7 +111,7 @@ main(A a) {
a.f;
}
''', [
- error(StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER, 50, 1),
+ error(CompileTimeErrorCode.INSTANCE_ACCESS_TO_STATIC_MEMBER, 50, 1),
]);
}
@@ -124,7 +124,7 @@ main(A a) {
a.f = 42;
}
''', [
- error(StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER, 49, 1),
+ error(CompileTimeErrorCode.INSTANCE_ACCESS_TO_STATIC_MEMBER, 49, 1),
]);
}
}
diff --git a/pkg/analyzer/test/src/diagnostics/invalid_assignment_test.dart b/pkg/analyzer/test/src/diagnostics/invalid_assignment_test.dart
index 348b42222af..277a933df72 100644
--- a/pkg/analyzer/test/src/diagnostics/invalid_assignment_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/invalid_assignment_test.dart
@@ -26,7 +26,7 @@ void f(int i) {
d ??= i;
}
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 37, 1),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 37, 1),
]);
}
@@ -59,7 +59,7 @@ void f(Never x) {
}
''', [
error(HintCode.DEAD_CODE, 24, 5),
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 24, 4),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 24, 4),
]);
}
@@ -72,7 +72,7 @@ void f() {
}
''', [
error(HintCode.DEAD_CODE, 37, 5),
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 37, 4),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 37, 4),
]);
}
@@ -88,7 +88,7 @@ class B {
}
}
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 58, 1),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 58, 1),
]);
}
}
@@ -129,7 +129,7 @@ void main() {
f({String x: 0}) {
}
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 13, 1),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 13, 1),
]);
}
@@ -143,7 +143,7 @@ f({String x: '0'}) {
await assertErrorsInCode(r'''
f([String x = 0]) {
}''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 14, 1),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 14, 1),
]);
}
@@ -160,7 +160,7 @@ main() {
dynamic = 1;
}
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 21, 1),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 21, 1),
]);
}
@@ -170,7 +170,7 @@ class C {
String x = (() => 5)();
}
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 23, 11),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 23, 11),
]);
}
@@ -181,7 +181,7 @@ void f(int i) {
d ??= i;
}
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 36, 1),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 36, 1),
]);
}
@@ -292,7 +292,7 @@ f(var y) {
}
}
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 80, 1),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 80, 1),
]);
}
@@ -316,7 +316,7 @@ f() {
}
''', [
error(HintCode.UNUSED_LOCAL_VARIABLE, 12, 1),
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 21, 3),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 21, 3),
]);
}
@@ -329,7 +329,7 @@ f(var y) {
}
}
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 44, 1),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 44, 1),
]);
}
@@ -345,7 +345,7 @@ f(A a) {
a++;
}
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 65, 3),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 65, 3),
]);
}
@@ -377,7 +377,7 @@ f(C c) {
c.a++;
}
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 91, 5),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 91, 5),
]);
}
@@ -409,7 +409,7 @@ f(A a) {
++a;
}
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 65, 3),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 65, 3),
]);
}
@@ -441,7 +441,7 @@ f(C c) {
++c.a;
}
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 91, 5),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 91, 5),
]);
}
@@ -491,7 +491,7 @@ class C {
T t = int;
}
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 21, 3),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 21, 3),
]);
}
@@ -504,7 +504,7 @@ f() {
A.x = '0';
}
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 46, 3),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 46, 3),
]);
}
@@ -519,7 +519,7 @@ f(var y) {
}
}
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 74, 1),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 74, 1),
]);
}
@@ -527,7 +527,7 @@ f(var y) {
await assertErrorsInCode('''
int x = 'string';
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 8, 8),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 8, 8),
]);
}
@@ -541,7 +541,7 @@ class B {
}
}
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 57, 1),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 57, 1),
]);
}
@@ -559,7 +559,7 @@ void f(X x) {
}
}
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 131, 1),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 131, 1),
]);
}
@@ -569,7 +569,7 @@ class A {
int x = 'string';
}
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 20, 8),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 20, 8),
]);
}
@@ -590,7 +590,7 @@ main() {
print(n);
}
''', [
- error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 218, 7),
+ error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 218, 7),
]);
}
}
diff --git a/pkg/analyzer/test/src/diagnostics/invocation_of_non_function_expression_test.dart b/pkg/analyzer/test/src/diagnostics/invocation_of_non_function_expression_test.dart
index 0554340cbca..9435340dccb 100644
--- a/pkg/analyzer/test/src/diagnostics/invocation_of_non_function_expression_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/invocation_of_non_function_expression_test.dart
@@ -21,7 +21,7 @@ f() {
3(5);
}
''', [
- error(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION, 8, 1),
+ error(CompileTimeErrorCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION, 8, 1),
]);
}
}
diff --git a/pkg/analyzer/test/src/diagnostics/non_bool_condition_test.dart b/pkg/analyzer/test/src/diagnostics/non_bool_condition_test.dart
index 02438ae5980..2ee87259c81 100644
--- a/pkg/analyzer/test/src/diagnostics/non_bool_condition_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/non_bool_condition_test.dart
@@ -21,7 +21,7 @@ class NonBoolConditionTest extends DriverResolutionTest {
await assertErrorsInCode('''
f() { return 3 ? 2 : 1; }
''', [
- error(StaticTypeWarningCode.NON_BOOL_CONDITION, 13, 1),
+ error(CompileTimeErrorCode.NON_BOOL_CONDITION, 13, 1),
]);
}
@@ -31,7 +31,7 @@ f() {
do {} while (3);
}
''', [
- error(StaticTypeWarningCode.NON_BOOL_CONDITION, 21, 1),
+ error(CompileTimeErrorCode.NON_BOOL_CONDITION, 21, 1),
]);
}
@@ -42,7 +42,7 @@ f() {
for (;3;) {}
}
''', [
- error(StaticTypeWarningCode.NON_BOOL_CONDITION, 14, 1),
+ error(CompileTimeErrorCode.NON_BOOL_CONDITION, 14, 1),
]);
}
@@ -50,7 +50,7 @@ f() {
await assertErrorsInCode('''
var v = [for (; 0;) 1];
''', [
- error(StaticTypeWarningCode.NON_BOOL_CONDITION, 16, 1),
+ error(CompileTimeErrorCode.NON_BOOL_CONDITION, 16, 1),
]);
}
@@ -60,7 +60,7 @@ f() {
if (3) return 2; else return 1;
}
''', [
- error(StaticTypeWarningCode.NON_BOOL_CONDITION, 12, 1),
+ error(CompileTimeErrorCode.NON_BOOL_CONDITION, 12, 1),
]);
}
@@ -68,7 +68,7 @@ f() {
await assertErrorsInCode('''
var v = [if (3) 1];
''', [
- error(StaticTypeWarningCode.NON_BOOL_CONDITION, 13, 1),
+ error(CompileTimeErrorCode.NON_BOOL_CONDITION, 13, 1),
]);
}
@@ -78,7 +78,7 @@ f() {
while (3) {}
}
''', [
- error(StaticTypeWarningCode.NON_BOOL_CONDITION, 15, 1),
+ error(CompileTimeErrorCode.NON_BOOL_CONDITION, 15, 1),
]);
}
}
@@ -93,7 +93,7 @@ m() {
if (x) {}
}
''', [
- error(StaticTypeWarningCode.NON_BOOL_CONDITION, 22, 1),
+ error(CompileTimeErrorCode.NON_BOOL_CONDITION, 22, 1),
]);
}
@@ -104,7 +104,7 @@ m() {
x ? 0 : 1;
}
''', [
- error(StaticTypeWarningCode.NON_BOOL_CONDITION, 18, 1),
+ error(CompileTimeErrorCode.NON_BOOL_CONDITION, 18, 1),
]);
}
}
diff --git a/pkg/analyzer/test/src/diagnostics/non_bool_expression_test.dart b/pkg/analyzer/test/src/diagnostics/non_bool_expression_test.dart
index 258accbe7ed..61535c7a923 100644
--- a/pkg/analyzer/test/src/diagnostics/non_bool_expression_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/non_bool_expression_test.dart
@@ -22,7 +22,7 @@ f() {
assert(makeAssertion);
}
''', [
- error(StaticTypeWarningCode.NON_BOOL_EXPRESSION, 45, 13),
+ error(CompileTimeErrorCode.NON_BOOL_EXPRESSION, 45, 13),
]);
}
@@ -33,7 +33,7 @@ f() {
assert(makeAssertion);
}
''', [
- error(StaticTypeWarningCode.NON_BOOL_EXPRESSION, 41, 13),
+ error(CompileTimeErrorCode.NON_BOOL_EXPRESSION, 41, 13),
]);
}
@@ -43,7 +43,7 @@ f() {
assert(0);
}
''', [
- error(StaticTypeWarningCode.NON_BOOL_EXPRESSION, 15, 1),
+ error(CompileTimeErrorCode.NON_BOOL_EXPRESSION, 15, 1),
]);
}
}
diff --git a/pkg/analyzer/test/src/diagnostics/non_bool_negation_expression_test.dart b/pkg/analyzer/test/src/diagnostics/non_bool_negation_expression_test.dart
index 7eb4c529d4d..f0c4ff3e266 100644
--- a/pkg/analyzer/test/src/diagnostics/non_bool_negation_expression_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/non_bool_negation_expression_test.dart
@@ -23,7 +23,7 @@ f() {
!42;
}
''', [
- error(StaticTypeWarningCode.NON_BOOL_NEGATION_EXPRESSION, 9, 2),
+ error(CompileTimeErrorCode.NON_BOOL_NEGATION_EXPRESSION, 9, 2),
]);
}
}
@@ -39,7 +39,7 @@ m() {
}
''', [
error(HintCode.UNUSED_LOCAL_VARIABLE, 13, 1),
- error(StaticTypeWarningCode.NON_BOOL_NEGATION_EXPRESSION, 19, 1),
+ error(CompileTimeErrorCode.NON_BOOL_NEGATION_EXPRESSION, 19, 1),
]);
}
}
diff --git a/pkg/analyzer/test/src/diagnostics/non_bool_operand_test.dart b/pkg/analyzer/test/src/diagnostics/non_bool_operand_test.dart
index 07c6c1dff52..f3496efdcd7 100644
--- a/pkg/analyzer/test/src/diagnostics/non_bool_operand_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/non_bool_operand_test.dart
@@ -23,7 +23,7 @@ bool f(int left, bool right) {
return left && right;
}
''', [
- error(StaticTypeWarningCode.NON_BOOL_OPERAND, 40, 4),
+ error(CompileTimeErrorCode.NON_BOOL_OPERAND, 40, 4),
]);
}
@@ -33,7 +33,7 @@ bool f(bool left, String right) {
return left && right;
}
''', [
- error(StaticTypeWarningCode.NON_BOOL_OPERAND, 51, 5),
+ error(CompileTimeErrorCode.NON_BOOL_OPERAND, 51, 5),
]);
}
@@ -43,7 +43,7 @@ bool f(List left, bool right) {
return left || right;
}
''', [
- error(StaticTypeWarningCode.NON_BOOL_OPERAND, 46, 4),
+ error(CompileTimeErrorCode.NON_BOOL_OPERAND, 46, 4),
]);
}
@@ -53,7 +53,7 @@ bool f(bool left, double right) {
return left || right;
}
''', [
- error(StaticTypeWarningCode.NON_BOOL_OPERAND, 51, 5),
+ error(CompileTimeErrorCode.NON_BOOL_OPERAND, 51, 5),
]);
}
}
@@ -68,7 +68,7 @@ m() {
if(x && true) {}
}
''', [
- error(StaticTypeWarningCode.NON_BOOL_OPERAND, 21, 1),
+ error(CompileTimeErrorCode.NON_BOOL_OPERAND, 21, 1),
]);
}
@@ -79,7 +79,7 @@ m() {
if(x || false) {}
}
''', [
- error(StaticTypeWarningCode.NON_BOOL_OPERAND, 21, 1),
+ error(CompileTimeErrorCode.NON_BOOL_OPERAND, 21, 1),
]);
}
}
diff --git a/pkg/analyzer/test/src/diagnostics/non_native_function_type_argument_to_pointer_test.dart b/pkg/analyzer/test/src/diagnostics/non_native_function_type_argument_to_pointer_test.dart
index 576cbdbdccf..0ec59d12210 100644
--- a/pkg/analyzer/test/src/diagnostics/non_native_function_type_argument_to_pointer_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/non_native_function_type_argument_to_pointer_test.dart
@@ -28,7 +28,7 @@ class C {
''', [
// This changed from a method to a extension method, uses Dart semantics
// instead of manual check now.
- error(StaticTypeWarningCode.UNDEFINED_METHOD, 98, 10),
+ error(CompileTimeErrorCode.UNDEFINED_METHOD, 98, 10),
]);
}
diff --git a/pkg/analyzer/test/src/diagnostics/non_type_as_type_argument_test.dart b/pkg/analyzer/test/src/diagnostics/non_type_as_type_argument_test.dart
index 82e57ab474a..cd93d589075 100644
--- a/pkg/analyzer/test/src/diagnostics/non_type_as_type_argument_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/non_type_as_type_argument_test.dart
@@ -21,7 +21,7 @@ int A;
class B {}
f(B b) {}
''', [
- error(StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT, 25, 1),
+ error(CompileTimeErrorCode.NON_TYPE_AS_TYPE_ARGUMENT, 25, 1),
]);
}
@@ -30,7 +30,7 @@ f(B b) {}
class B {}
f(B b) {}
''', [
- error(StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT, 18, 1),
+ error(CompileTimeErrorCode.NON_TYPE_AS_TYPE_ARGUMENT, 18, 1),
]);
}
}
diff --git a/pkg/analyzer/test/src/diagnostics/receiver_of_type_never_test.dart b/pkg/analyzer/test/src/diagnostics/receiver_of_type_never_test.dart
index 67439cb09de..5e10b8c59a6 100644
--- a/pkg/analyzer/test/src/diagnostics/receiver_of_type_never_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/receiver_of_type_never_test.dart
@@ -191,7 +191,7 @@ void main(Never? x) {
}
''', [
error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 24, 1),
- error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 25, 3),
+ error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 25, 3),
]);
assertIndexExpression(
@@ -209,8 +209,8 @@ void main(Never? x) {
}
''', [
error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 24, 1),
- error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 25, 3),
- error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 25, 3),
+ error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 25, 3),
+ error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 25, 3),
]);
assertIndexExpression(
@@ -230,7 +230,7 @@ void main(Never? x) {
}
''', [
error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 24, 1),
- error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 25, 3),
+ error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 25, 3),
]);
assertIndexExpression(
@@ -536,7 +536,7 @@ void main() {
(throw '') + (1 + 2);
}
''', [
- error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 27, 1),
+ error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 27, 1),
]);
assertBinaryExpression(
diff --git a/pkg/analyzer/test/src/diagnostics/return_of_invalid_type_test.dart b/pkg/analyzer/test/src/diagnostics/return_of_invalid_type_test.dart
index 74f3305a6e7..cc197347f7b 100644
--- a/pkg/analyzer/test/src/diagnostics/return_of_invalid_type_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/return_of_invalid_type_test.dart
@@ -24,7 +24,7 @@ Td f() {
return () => "hello";
}
''', [
- error(StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE, 53, 7),
+ error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE, 53, 7),
]);
}
@@ -35,7 +35,7 @@ class C {
}
''', [
error(
- StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_CONSTRUCTOR, 33, 1),
+ CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_CONSTRUCTOR, 33, 1),
]);
}
@@ -46,7 +46,7 @@ class C {
}
''', [
error(
- StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_CONSTRUCTOR, 27, 1),
+ CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_CONSTRUCTOR, 27, 1),
]);
}
@@ -68,7 +68,7 @@ Future f(Future> a) async {
return a;
}
''', [
- error(StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 54, 1),
+ error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 54, 1),
]);
}
@@ -85,7 +85,7 @@ int f() async {
return 5;
}
''', [
- error(StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE, 0, 3),
+ error(CompileTimeErrorCode.ILLEGAL_ASYNC_RETURN_TYPE, 0, 3),
]);
}
@@ -111,7 +111,7 @@ Future f() async {
return 5;
}
''', [
- error(StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 36, 1),
+ error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 36, 1),
]);
}
@@ -121,7 +121,7 @@ void f() async {
return 5;
}
''', [
- error(StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 26, 1),
+ error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 26, 1),
]);
}
@@ -139,7 +139,7 @@ Future f(void a) async {
return a;
}
''', [
- error(StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 39, 1),
+ error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 39, 1),
]);
}
@@ -189,13 +189,13 @@ void f() {
return 42;
}
''', [
- error(StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 20, 2),
+ error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 20, 2),
]);
}
test_function_sync_block_num__to_int() async {
var expectedErrors = expectedErrorsByNullability(nullable: [
- error(StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 24, 1),
+ error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 24, 1),
], legacy: []);
await assertErrorsInCode(r'''
int f(num a) {
@@ -210,7 +210,7 @@ int f() {
return '0';
}
''', [
- error(StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 19, 3),
+ error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 19, 3),
]);
}
@@ -246,13 +246,13 @@ int f(void a) {
return a;
}
''', [
- error(StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 25, 1),
+ error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 25, 1),
]);
}
test_function_sync_block_void__to_Null() async {
var expectedErrors = expectedErrorsByNullability(nullable: [
- error(StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 26, 1),
+ error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 26, 1),
], legacy: []);
await assertErrorsInCode('''
Null f(void a) {
@@ -279,7 +279,7 @@ void f() => 42;
await assertErrorsInCode('''
int f() => '0';
''', [
- error(StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 11, 3),
+ error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 11, 3),
]);
}
@@ -289,7 +289,7 @@ int get g {
return '0';
}
''', [
- error(StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 21, 3),
+ error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 21, 3),
]);
}
@@ -297,7 +297,7 @@ int get g {
await assertErrorsInCode('''
int get g => '0';
''', [
- error(StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 13, 3),
+ error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 13, 3),
]);
}
@@ -310,7 +310,7 @@ void f() {
g();
}
''', [
- error(StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 34, 3),
+ error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 34, 3),
]);
}
@@ -323,7 +323,7 @@ class A {
}
}
''', [
- error(StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 38, 3),
+ error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 38, 3),
]);
}
@@ -354,7 +354,7 @@ class A {
}
}
''', [
- error(StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_METHOD, 33, 3),
+ error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_METHOD, 33, 3),
]);
}
@@ -376,7 +376,7 @@ class A {
int f() => '0';
}
''', [
- error(StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_METHOD, 23, 3),
+ error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_METHOD, 23, 3),
]);
}
}
@@ -390,7 +390,7 @@ Future f() async {
return 0;
}
''', [
- error(StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 34, 1),
+ error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 34, 1),
]);
}
@@ -400,7 +400,7 @@ Future f(void a) async {
return a;
}
''', [
- error(StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 40, 1),
+ error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 40, 1),
]);
}
@@ -412,7 +412,7 @@ FutureOr