Move codes from StaticTypeWarningCode into CompileTimeErrorCode.

They are all errors now.

Change-Id: If48d38e38e845fd5b5a950dd5514bf1cbbce03d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
Konstantin Shcheglov
2020-07-27 16:44:15 +00:00
parent 2044eae133
commit 8de8a1c226
377 changed files with 2903 additions and 2946 deletions
@@ -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));
}
}
@@ -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 ||
@@ -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,
],
@@ -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']
]);
@@ -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> a) {
class A {}
class B {}
''');
await assertHasFixAllFix(StaticTypeWarningCode.INVALID_ASSIGNMENT, '''
await assertHasFixAllFix(CompileTimeErrorCode.INVALID_ASSIGNMENT, '''
f(List<A> a) {
List<B> b, b2;
b = a.where((e) => e is B).cast<B>().toList();
@@ -148,7 +148,7 @@ f(Map<A, B> a) {
class A {}
class B {}
''');
await assertHasFixAllFix(StaticTypeWarningCode.INVALID_ASSIGNMENT, '''
await assertHasFixAllFix(CompileTimeErrorCode.INVALID_ASSIGNMENT, '''
f(Map<A, B> a) {
Map<B, A> b, b2;
b = a.cast<B, A>();
@@ -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> a) {
class A {}
class B {}
''');
await assertHasFixAllFix(StaticTypeWarningCode.INVALID_ASSIGNMENT, '''
await assertHasFixAllFix(CompileTimeErrorCode.INVALID_ASSIGNMENT, '''
f(Set<A> a) {
Set<B> b, b2;
b = a.cast<B>();
@@ -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> a) {
class A {}
class B {}
''');
await assertHasFixAllFix(StaticTypeWarningCode.INVALID_ASSIGNMENT, '''
await assertHasFixAllFix(CompileTimeErrorCode.INVALID_ASSIGNMENT, '''
f(List<A> a) {
List<B> b = a.where((e) => e is B).cast<B>().toList();
List<B> b2 = a.where((e) => e is B).cast<B>().toList();
@@ -367,7 +367,7 @@ f(Map<A, B> a) {
class A {}
class B {}
''');
await assertHasFixAllFix(StaticTypeWarningCode.INVALID_ASSIGNMENT, '''
await assertHasFixAllFix(CompileTimeErrorCode.INVALID_ASSIGNMENT, '''
f(Map<A, B> a) {
Map<B, A> b = a.cast<B, A>();
Map<B, A> b2 = a.cast<B, A>();
@@ -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> a) {
class A {}
class B {}
''');
await assertHasFixAllFix(StaticTypeWarningCode.INVALID_ASSIGNMENT, '''
await assertHasFixAllFix(CompileTimeErrorCode.INVALID_ASSIGNMENT, '''
f(Set<A> a) {
Set<B> b = a.cast<B>();
Set<B> b2 = a.cast<B>();
@@ -469,7 +469,7 @@ void foo(int a) {
''');
await assertNoFix(
errorFilter: (e) {
return e.errorCode == StaticTypeWarningCode.INVALID_ASSIGNMENT;
return e.errorCode == CompileTimeErrorCode.INVALID_ASSIGNMENT;
},
);
}
@@ -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);
@@ -78,7 +78,7 @@ int foo =
''');
await assertNoFix(
errorFilter: (e) {
return e.errorCode == StaticTypeWarningCode.INVALID_ASSIGNMENT;
return e.errorCode == CompileTimeErrorCode.INVALID_ASSIGNMENT;
},
);
}
@@ -379,7 +379,7 @@ main(A a) {
}
''');
await assertNoFix(errorFilter: (e) {
return e.errorCode == StaticTypeWarningCode.UNDEFINED_GETTER;
return e.errorCode == CompileTimeErrorCode.UNDEFINED_GETTER;
});
}
@@ -322,7 +322,7 @@ main(A a) {
}
''');
await assertNoFix(errorFilter: (e) {
return e.errorCode == StaticTypeWarningCode.UNDEFINED_GETTER;
return e.errorCode == CompileTimeErrorCode.UNDEFINED_GETTER;
});
}
@@ -316,7 +316,7 @@ main(A a) {
}
''');
await assertNoFix(errorFilter: (e) {
return e.errorCode == StaticTypeWarningCode.UNDEFINED_SETTER;
return e.errorCode == CompileTimeErrorCode.UNDEFINED_SETTER;
});
}
@@ -29,7 +29,7 @@ var v;int main() async => 0;
import 'dart:async';
var v;Future<int> 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<List<int>> 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<List<int>> 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<int> 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<int> 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<int> 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<int> main() async {
}
''', errorFilter: (error) {
return error.errorCode == StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE;
return error.errorCode == CompileTimeErrorCode.ILLEGAL_ASYNC_RETURN_TYPE;
});
}
+36 -36
View File
@@ -154,6 +154,9 @@ const List<ErrorCode> 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<ErrorCode> 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<ErrorCode> 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<ErrorCode> 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<ErrorCode> 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<ErrorCode> 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<ErrorCode> 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<ErrorCode> 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<ErrorCode> 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<ErrorCode> 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<ErrorCode> 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<ErrorCode> 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<ErrorCode> 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,
@@ -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
@@ -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,
@@ -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],
);
@@ -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]);
@@ -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],
);
@@ -406,7 +406,7 @@ class InvocationInferenceHelper {
List<DartType> 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,
@@ -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],
);
@@ -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],
);
@@ -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],
);
@@ -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],
);
@@ -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],
);
@@ -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,
);
}
File diff suppressed because it is too large Load Diff
@@ -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],
);
@@ -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);
}
@@ -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);
@@ -521,7 +521,7 @@ class ElementResolver extends SimpleAstVisitor<void> {
[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<void> {
}
/// 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<void> {
);
} 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<void> {
);
} else {
_errorReporter.reportErrorForOffset(
StaticTypeWarningCode.UNDEFINED_OPERATOR,
CompileTimeErrorCode.UNDEFINED_OPERATOR,
offset,
length,
[methodName, staticType],
@@ -1320,8 +1320,8 @@ class ElementResolver extends SimpleAstVisitor<void> {
_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<void> {
// 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<void> {
);
} else {
_errorReporter.reportErrorForNode(
StaticTypeWarningCode.UNDEFINED_SUPER_GETTER,
CompileTimeErrorCode.UNDEFINED_SUPER_GETTER,
propertyName,
[propertyName.name, staticType],
);
@@ -1433,7 +1433,7 @@ class ElementResolver extends SimpleAstVisitor<void> {
}
} else {
_errorReporter.reportErrorForNode(
StaticTypeWarningCode.UNDEFINED_SUPER_SETTER,
CompileTimeErrorCode.UNDEFINED_SUPER_SETTER,
propertyName,
[propertyName.name, staticType],
);
@@ -1494,7 +1494,7 @@ class ElementResolver extends SimpleAstVisitor<void> {
}
if (shouldReportUndefinedGetter) {
_errorReporter.reportErrorForNode(
StaticTypeWarningCode.UNDEFINED_GETTER,
CompileTimeErrorCode.UNDEFINED_GETTER,
propertyName,
[propertyName.name, staticType],
);
@@ -1517,7 +1517,7 @@ class ElementResolver extends SimpleAstVisitor<void> {
// OK
} else {
_errorReporter.reportErrorForNode(
StaticTypeWarningCode.UNDEFINED_SETTER,
CompileTimeErrorCode.UNDEFINED_SETTER,
propertyName,
[propertyName.name, staticType],
);
@@ -711,7 +711,7 @@ class ErrorVerifier extends RecursiveAstVisitor<void> {
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<void> {
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<void> {
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<void> {
/// 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<void> {
}
}
_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<void> {
/// 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<void> {
}
_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<void> {
/// 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<TypeParameter> parameters) {
Map<TypeParameterElement, TypeParameter> elementToNode;
for (var parameter in parameters) {
@@ -4074,7 +4074,7 @@ class ErrorVerifier extends RecursiveAstVisitor<void> {
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<void> {
/// 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<void> {
[enclosingElement.displayName]);
} else {
_errorReporter.reportErrorForNode(
StaticTypeWarningCode
CompileTimeErrorCode
.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER,
name,
[enclosingElement.displayName]);
+2 -2
View File
@@ -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);
@@ -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<String>();
''',
[
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<int>();
''',
[
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),
]);
}
@@ -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),
]);
}
@@ -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),
]);
}
@@ -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)],
);
}
@@ -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),
]);
}
+2 -2
View File
@@ -6880,7 +6880,7 @@ mixin ExpressionParserTestMixin implements AbstractParserTestCase {
InstanceCreationExpressionImpl expression =
parseExpression('new a.b.c<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<B>.c<C>();') as ExpressionStatement;
assertErrorsWithCodes(
[StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR]);
[CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR]);
expect(statement.expression, isNotNull);
}
@@ -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<int> 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),
]);
}
}
@@ -786,7 +786,7 @@ f() {
List<List<int>> b;
b[0][0] = 'hi';
}''', [
error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 39, 4),
error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 39, 4),
]);
verifyTestResolved();
}
@@ -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<T extends Iterable<int>> {
}
''', [
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<V> p) {
}
}
''', [
error(StaticTypeWarningCode.UNDEFINED_GETTER, 100, 1),
error(CompileTimeErrorCode.UNDEFINED_GETTER, 100, 1),
]);
}
@@ -462,7 +462,7 @@ main(A<V> 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<V> p) {
}
}
''', [
error(StaticTypeWarningCode.UNDEFINED_GETTER, 103, 1),
error(CompileTimeErrorCode.UNDEFINED_GETTER, 103, 1),
]);
}
@@ -578,7 +578,7 @@ main(A<V> p) {
}
}
''', [
error(StaticTypeWarningCode.UNDEFINED_GETTER, 112, 1),
error(CompileTimeErrorCode.UNDEFINED_GETTER, 112, 1),
]);
}
@@ -591,7 +591,7 @@ main(A<NoSuchType> a) {
a.element.anyGetterExistsInDynamic;
}
''', [
error(StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT, 35, 10),
error(CompileTimeErrorCode.NON_TYPE_AS_TYPE_ARGUMENT, 35, 10),
]);
}
}
@@ -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<int> 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<int> 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<dynamic> does not have all methods
MethodInvocation invoke = await _testFutureOr(r'''
dynamic test(FutureOr<dynamic> 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),
]);
}
@@ -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']
]);
@@ -1666,7 +1666,7 @@ String z = "string";
ResolvedUnitResult result = await driver.getResult(b);
List<AnalysisError> errors = result.errors;
expect(errors, hasLength(1));
expect(errors[0].errorCode, StaticTypeWarningCode.INVALID_ASSIGNMENT);
expect(errors[0].errorCode, CompileTimeErrorCode.INVALID_ASSIGNMENT);
}
}
@@ -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),
]);
}
@@ -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');
}
@@ -138,7 +138,7 @@ f() {
prefix.A.named<int>(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<int, String>(0);
}
''', [
error(StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
error(CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
52, 13),
]);
@@ -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),
]);
}
}
@@ -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),
]);
}
@@ -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),
]);
}
@@ -19,7 +19,7 @@ class InstanceCreationDriverResolutionTest extends DriverResolutionTest {
await assertErrorsInCode(r'''
final foo = Map<int>();
''', [
error(StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 12, 8),
error(CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 12, 8),
]);
var creation = findNode.instanceCreation('Map<int>');
@@ -42,7 +42,7 @@ main() {
new Foo.bar<int>();
}
''', [
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<int>();
}
''', [
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<int>();
}
''', [
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<int>();
}
''', [
error(StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
error(CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
43, 5),
]);
@@ -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<int>();
}
''', [
error(StaticTypeWarningCode.UNDEFINED_METHOD, 25, 3),
error(CompileTimeErrorCode.UNDEFINED_METHOD, 25, 3),
]);
_assertUnresolvedMethodInvocation(
@@ -499,7 +499,7 @@ class C<T> {
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<int>();
}
''', [
error(StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD, 29, 5),
error(CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD, 29, 5),
]);
assertMethodInvocation(
findNode.methodInvocation('foo<int>()'),
@@ -848,7 +848,7 @@ main() {
foo<int>();
}
''', [
error(StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD, 58, 5),
error(CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD, 58, 5),
]);
assertMethodInvocation(
findNode.methodInvocation('foo<int>()'),
@@ -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<int, double>();');
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(
@@ -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)');
@@ -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(
@@ -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;');
@@ -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');
@@ -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;');
@@ -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<void> 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 = () {
@@ -43,7 +43,7 @@ List<String> 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<E extends List<int>> {
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<E extends List<dynamic>> {
await assertErrorsInCode('''
List<String> a = <int>[0];
''', [
error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 17, 8),
error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 17, 8),
]);
assertType(findNode.listLiteral('['), 'List<int>');
}
@@ -113,7 +113,7 @@ List<String> a = <String>['a'];
await assertErrorsInCode('''
List<String> a = <int>[];
''', [
error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 17, 7),
error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 17, 7),
]);
assertType(findNode.listLiteral('['), 'List<int>');
}
@@ -66,7 +66,7 @@ Map<String, String> 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<E extends Map<int, String>> {
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<String, String> a = <String, String>{'a' : 'b'};
await assertErrorsInCode('''
Map<String, String> a = <int, int>{};
''', [
error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 24, 12),
error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 24, 12),
]);
assertType(setOrMapLiteral('{'), 'Map<int, int>');
}
@@ -57,7 +57,7 @@ FutureOr<Set<int>> 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<E extends Set<int>> {
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<String> a = <String>{'a'};
await assertErrorsInCode('''
Set<String> a = <int>{};
''', [
error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 16, 7),
error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 16, 7),
]);
assertType(setLiteral('{'), 'Set<int>');
}
@@ -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),
]);
}
@@ -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),
]);
}
}
@@ -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),
]);
}
@@ -28,7 +28,7 @@ main() {
main() {
<int, int>[];
}''', [
error(StaticTypeWarningCode.EXPECTED_ONE_LIST_TYPE_ARGUMENTS, 11, 10),
error(CompileTimeErrorCode.EXPECTED_ONE_LIST_TYPE_ARGUMENTS, 11, 10),
]);
}
}
@@ -20,7 +20,7 @@ class ExpectedOneSetTypeArgumentsTest extends DriverResolutionTest {
main() {
<int, int, int>{2, 3};
}''', [
error(StaticTypeWarningCode.EXPECTED_ONE_SET_TYPE_ARGUMENTS, 11, 15),
error(CompileTimeErrorCode.EXPECTED_ONE_SET_TYPE_ARGUMENTS, 11, 15),
]);
}
}
@@ -22,7 +22,7 @@ class ExpectedTwoMapTypeArgumentsTest extends DriverResolutionTest {
main() {
<int, int, int>{};
}''', [
error(StaticTypeWarningCode.EXPECTED_TWO_MAP_TYPE_ARGUMENTS, 11, 15),
error(CompileTimeErrorCode.EXPECTED_TWO_MAP_TYPE_ARGUMENTS, 11, 15),
]);
}
@@ -31,7 +31,7 @@ main() {
main() {
<int, int, int>{1: 2};
}''', [
error(StaticTypeWarningCode.EXPECTED_TWO_MAP_TYPE_ARGUMENTS, 11, 15),
error(CompileTimeErrorCode.EXPECTED_TWO_MAP_TYPE_ARGUMENTS, 11, 15),
]);
}
@@ -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<T extends Iterable<int>> {
}
''', [
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),
]);
}
}
@@ -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),
]);
}
}
@@ -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<int> 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),
]);
}
}
@@ -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),
]);
}
}
@@ -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<T> {
}
}
''', [
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 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<T> {
}
}
''', [
error(StaticTypeWarningCode.INVALID_ASSIGNMENT, 57, 1),
error(CompileTimeErrorCode.INVALID_ASSIGNMENT, 57, 1),
]);
}
@@ -559,7 +559,7 @@ void f<X extends A, Y extends B>(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),
]);
}
}
@@ -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),
]);
}
}
@@ -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),
]);
}
}
@@ -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),
]);
}
}
@@ -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),
]);
}
}
@@ -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<int> 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),
]);
}
}
@@ -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),
]);
}
@@ -21,7 +21,7 @@ int A;
class B<E> {}
f(B<A> 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<A> b) {}
class B<E> {}
f(B<A> b) {}
''', [
error(StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT, 18, 1),
error(CompileTimeErrorCode.NON_TYPE_AS_TYPE_ARGUMENT, 18, 1),
]);
}
}
@@ -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(
@@ -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<int> f(Future<Future<int>> 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<String> 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<int> 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<void> 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<Null> 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<Object?> f(void a) async {
return a;
}
''', [
error(StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 67, 1),
error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 67, 1),
]);
}
@@ -30,7 +30,7 @@ class SdkVersionGtGtGtOperatorTest extends SdkConstraintVerifierTest {
await verifyVersion('2.5.0', '''
const a = 42 >>> 3;
''', expectedErrors: [
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 13, 3),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 13, 3),
]);
}
@@ -41,7 +41,7 @@ const a = 42 >>> 3;
const a = 42 >>> 3;
''', expectedErrors: [
error(HintCode.SDK_VERSION_GT_GT_GT_OPERATOR, 13, 3),
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 13, 3),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 13, 3),
]);
}
@@ -69,7 +69,7 @@ class A {
await verifyVersion('2.5.0', '''
var a = 42 >>> 3;
''', expectedErrors: [
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 11, 3),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 11, 3),
]);
}
@@ -80,7 +80,7 @@ var a = 42 >>> 3;
var a = 42 >>> 3;
''', expectedErrors: [
error(HintCode.SDK_VERSION_GT_GT_GT_OPERATOR, 11, 3),
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 11, 3),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 11, 3),
]);
}
}
@@ -33,7 +33,7 @@ main() {
}
''', [
error(CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, 0, 37),
error(StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 101, 1),
error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 101, 1),
]);
}
@@ -22,7 +22,7 @@ class TypeParameterSupertypeOfItsBoundTest extends DriverResolutionTest {
class A<T extends T> {
}
''', [
error(StaticTypeWarningCode.TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND, 8, 11),
error(CompileTimeErrorCode.TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND, 8, 11),
]);
}
@@ -34,7 +34,7 @@ class A<T extends T> {
}
}
''', [
error(StaticTypeWarningCode.TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND, 8, 11),
error(CompileTimeErrorCode.TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND, 8, 11),
]);
}
@@ -43,9 +43,9 @@ class A<T extends T> {
class A<T1 extends T3, T2, T3 extends T1> {
}
''', [
error(StaticTypeWarningCode.TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND, 8, 13),
error(CompileTimeErrorCode.TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND, 8, 13),
error(
StaticTypeWarningCode.TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND, 27, 13),
CompileTimeErrorCode.TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND, 27, 13),
]);
}
}
@@ -31,7 +31,7 @@ E e() {
return E.TWO;
}
''', [
error(StaticTypeWarningCode.UNDEFINED_ENUM_CONSTANT, 34, 3),
error(CompileTimeErrorCode.UNDEFINED_ENUM_CONSTANT, 34, 3),
]);
}
}
@@ -25,7 +25,7 @@ f(C c) {
c.foo += 1;
}
''', [
error(StaticTypeWarningCode.UNDEFINED_GETTER, 46, 3),
error(CompileTimeErrorCode.UNDEFINED_GETTER, 46, 3),
]);
}
@@ -39,7 +39,7 @@ f() {
C.foo += 1;
}
''', [
error(StaticTypeWarningCode.UNDEFINED_GETTER, 50, 3),
error(CompileTimeErrorCode.UNDEFINED_GETTER, 50, 3),
]);
}
@@ -57,7 +57,7 @@ extension E on C {
}
}
''', [
error(StaticTypeWarningCode.UNDEFINED_GETTER, 95, 3),
error(CompileTimeErrorCode.UNDEFINED_GETTER, 95, 3),
]);
}
@@ -70,7 +70,7 @@ f() {
0.foo;
}
''', [
error(StaticTypeWarningCode.UNDEFINED_GETTER, 58, 3),
error(CompileTimeErrorCode.UNDEFINED_GETTER, 58, 3),
]);
}
@@ -79,7 +79,7 @@ f() {
extension E on int {}
var a = 3.v;
''', [
error(StaticTypeWarningCode.UNDEFINED_GETTER, 32, 1),
error(CompileTimeErrorCode.UNDEFINED_GETTER, 32, 1),
]);
}
@@ -93,7 +93,7 @@ f(C c) {
c.a;
}
''', [
error(StaticTypeWarningCode.UNDEFINED_GETTER, 46, 1),
error(CompileTimeErrorCode.UNDEFINED_GETTER, 46, 1),
]);
}
@@ -111,7 +111,7 @@ f(C c) {
c.foo;
}
''', [
error(StaticTypeWarningCode.UNDEFINED_GETTER, 93, 3),
error(CompileTimeErrorCode.UNDEFINED_GETTER, 93, 3),
]);
}
@@ -132,7 +132,7 @@ f(int x) {
return [if (x is String) x.length];
}
''', [
error(StaticTypeWarningCode.UNDEFINED_GETTER, 40, 6),
error(CompileTimeErrorCode.UNDEFINED_GETTER, 40, 6),
]);
}
@@ -150,7 +150,7 @@ f(int x) {
return {if (x is String) x : x.length};
}
''', [
error(StaticTypeWarningCode.UNDEFINED_GETTER, 44, 6),
error(CompileTimeErrorCode.UNDEFINED_GETTER, 44, 6),
]);
}
@@ -168,7 +168,7 @@ f(int x) {
return {if (x is String) x.length};
}
''', [
error(StaticTypeWarningCode.UNDEFINED_GETTER, 40, 6),
error(CompileTimeErrorCode.UNDEFINED_GETTER, 40, 6),
]);
}
@@ -188,7 +188,7 @@ f(int x) {
}
}
''', [
error(StaticTypeWarningCode.UNDEFINED_GETTER, 38, 6),
error(CompileTimeErrorCode.UNDEFINED_GETTER, 38, 6),
]);
}
@@ -207,7 +207,7 @@ f(Object x) {
class T {}
f(T e) { return e.m; }
''', [
error(StaticTypeWarningCode.UNDEFINED_GETTER, 29, 1),
error(CompileTimeErrorCode.UNDEFINED_GETTER, 29, 1),
]);
}
@@ -217,7 +217,7 @@ mixin M {
f() { return this.m; }
}
''', [
error(StaticTypeWarningCode.UNDEFINED_GETTER, 30, 1),
error(CompileTimeErrorCode.UNDEFINED_GETTER, 30, 1),
]);
}
@@ -228,7 +228,7 @@ m() {
_null.foo;
}
''', [
error(StaticTypeWarningCode.UNDEFINED_GETTER, 28, 3),
error(CompileTimeErrorCode.UNDEFINED_GETTER, 28, 3),
]);
}
@@ -238,7 +238,7 @@ f(Object o) {
return o.call;
}
''', [
error(StaticTypeWarningCode.UNDEFINED_GETTER, 25, 4),
error(CompileTimeErrorCode.UNDEFINED_GETTER, 25, 4),
]);
}
@@ -250,7 +250,7 @@ void f<X extends num, Y extends X>(Y y) {
}
}
''', [
error(StaticTypeWarningCode.UNDEFINED_GETTER, 66, 6),
error(CompileTimeErrorCode.UNDEFINED_GETTER, 66, 6),
]);
}
@@ -266,7 +266,7 @@ main() {
new PrefixProxy().foo;
}
''', [
error(StaticTypeWarningCode.UNDEFINED_GETTER, 127, 3),
error(CompileTimeErrorCode.UNDEFINED_GETTER, 127, 3),
]);
}
@@ -290,7 +290,7 @@ class C extends S {}
f(var p) {
f(C.g);
}''', [
error(StaticTypeWarningCode.UNDEFINED_GETTER, 75, 1),
error(CompileTimeErrorCode.UNDEFINED_GETTER, 75, 1),
]);
}
@@ -300,7 +300,7 @@ class C {}
f(var p) {
f(C.m);
}''', [
error(StaticTypeWarningCode.UNDEFINED_GETTER, 28, 1),
error(CompileTimeErrorCode.UNDEFINED_GETTER, 28, 1),
]);
}
@@ -313,7 +313,7 @@ main() {
T..foo;
}
''', [
error(StaticTypeWarningCode.UNDEFINED_GETTER, 54, 3),
error(CompileTimeErrorCode.UNDEFINED_GETTER, 54, 3),
]);
}
@@ -324,7 +324,7 @@ main() {
class A {}
f() => A?.hashCode;
''', [
error(StaticTypeWarningCode.UNDEFINED_GETTER, 21, 8),
error(CompileTimeErrorCode.UNDEFINED_GETTER, 21, 8),
]);
}
@@ -169,7 +169,7 @@ main(int p) {
}
''', [
error(ParserErrorCode.MISSING_IDENTIFIER, 30, 1),
error(StaticTypeWarningCode.UNDEFINED_GETTER, 30, 1),
error(CompileTimeErrorCode.UNDEFINED_GETTER, 30, 1),
error(ParserErrorCode.MISSING_IDENTIFIER, 31, 1),
]);
}
@@ -39,7 +39,7 @@ f(B b) {
b.a();
}
''', [
error(StaticTypeWarningCode.UNDEFINED_METHOD, 33, 1),
error(CompileTimeErrorCode.UNDEFINED_METHOD, 33, 1),
]);
}
@@ -58,7 +58,7 @@ f(C c) {
c.a();
}
''', [
error(StaticTypeWarningCode.UNDEFINED_METHOD, 33, 1),
error(CompileTimeErrorCode.UNDEFINED_METHOD, 33, 1),
]);
}
@@ -91,7 +91,7 @@ class C {
}
}
''', [
error(StaticTypeWarningCode.UNDEFINED_METHOD, 85, 1),
error(CompileTimeErrorCode.UNDEFINED_METHOD, 85, 1),
]);
}
@@ -99,7 +99,7 @@ class C {
await assertErrorsInCode('''
f(bool b, int i) => (b ? null : i).foo();
''', [
error(StaticTypeWarningCode.UNDEFINED_METHOD, 35, 3),
error(CompileTimeErrorCode.UNDEFINED_METHOD, 35, 3),
]);
}
@@ -111,7 +111,7 @@ class C {
}
}
''', [
error(StaticTypeWarningCode.UNDEFINED_METHOD, 22, 3),
error(CompileTimeErrorCode.UNDEFINED_METHOD, 22, 3),
]);
}
@@ -122,7 +122,7 @@ f(C c) {
c..abs();
}
''', [
error(StaticTypeWarningCode.UNDEFINED_METHOD, 25, 3),
error(CompileTimeErrorCode.UNDEFINED_METHOD, 25, 3),
]);
}
@@ -131,7 +131,7 @@ f(C c) {
enum E { A }
f() => E.abs();
''', [
error(StaticTypeWarningCode.UNDEFINED_METHOD, 22, 3),
error(CompileTimeErrorCode.UNDEFINED_METHOD, 22, 3),
]);
}
@@ -142,7 +142,7 @@ f(M m) {
m.abs();
}
''', [
error(StaticTypeWarningCode.UNDEFINED_METHOD, 24, 3),
error(CompileTimeErrorCode.UNDEFINED_METHOD, 24, 3),
]);
}
@@ -153,7 +153,7 @@ f(M m) {
m..abs();
}
''', [
error(StaticTypeWarningCode.UNDEFINED_METHOD, 25, 3),
error(CompileTimeErrorCode.UNDEFINED_METHOD, 25, 3),
]);
}
@@ -164,7 +164,7 @@ main() {
f(42).abs();
}
''', [
error(StaticTypeWarningCode.UNDEFINED_METHOD, 40, 3),
error(CompileTimeErrorCode.UNDEFINED_METHOD, 40, 3),
]);
}
@@ -194,7 +194,7 @@ void main() {
B.named();
}
''', [
error(StaticTypeWarningCode.UNDEFINED_METHOD, 96, 5),
error(CompileTimeErrorCode.UNDEFINED_METHOD, 96, 5),
]);
}
@@ -210,7 +210,7 @@ f(C c) {
c.c();
}
''', [
error(StaticTypeWarningCode.UNDEFINED_METHOD, 61, 1),
error(CompileTimeErrorCode.UNDEFINED_METHOD, 61, 1),
]);
}
}
@@ -25,7 +25,7 @@ class B {
}
}
''', [
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 58, 2),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 58, 2),
]);
}
@@ -38,7 +38,7 @@ f(var a) {
}
}
''', [
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 44, 1),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 44, 1),
]);
}
@@ -47,7 +47,7 @@ f(var a) {
enum E { A }
f(E e) => e + 1;
''', [
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 25, 1),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 25, 1),
]);
}
@@ -63,7 +63,7 @@ f(var a) {
}
}
''', [
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 87, 1),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 87, 1),
]);
}
@@ -72,7 +72,7 @@ f(var a) {
mixin M {}
f(M m) => m + 1;
''', [
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 23, 1),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 23, 1),
]);
}
@@ -84,8 +84,8 @@ f(A a) {
a[0]++;
}
''', [
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 24, 3),
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 24, 3),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 24, 3),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 24, 3),
]);
}
@@ -109,7 +109,7 @@ f(E e) {
e[0];
}
''', [
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 25, 3),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 25, 3),
]);
}
@@ -141,7 +141,7 @@ f(A a) {
a[0];
}
''', [
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 125, 3),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 125, 3),
]);
}
@@ -153,7 +153,7 @@ f(A a) {
a[0];
}
''', [
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 24, 3),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 24, 3),
]);
}
@@ -164,7 +164,7 @@ f(M m) {
m[0];
}
''', [
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 23, 3),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 23, 3),
]);
}
@@ -174,7 +174,7 @@ f(Null x) {
x[0];
}
''', [
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 15, 3),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 15, 3),
]);
}
@@ -192,7 +192,7 @@ f(A a) {
a[0] = 1;
}
''', [
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 125, 3),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 125, 3),
]);
}
@@ -218,7 +218,7 @@ f(A a) {
a[0] = 1;
}
''', [
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 24, 3),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 24, 3),
]);
}
@@ -229,8 +229,8 @@ f(A a) {
a[0]++;
}
''', [
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 23, 3),
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 23, 3),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 23, 3),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 23, 3),
]);
}
@@ -241,7 +241,7 @@ f(A a) {
a[0];
}
''', [
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 23, 3),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 23, 3),
]);
}
@@ -252,7 +252,7 @@ f(A a) {
a[0] = 1;
}
''', [
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 23, 3),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 23, 3),
]);
}
@@ -263,7 +263,7 @@ m() {
x - 3;
}
''', [
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 20, 1),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 20, 1),
]);
}
@@ -275,7 +275,7 @@ m() {
}
''', [
error(HintCode.UNUSED_LOCAL_VARIABLE, 13, 1),
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 20, 2),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 20, 2),
]);
}
@@ -286,7 +286,7 @@ m() {
x + 3;
}
''', [
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 20, 1),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 20, 1),
]);
}
@@ -297,7 +297,7 @@ f(A a) {
a + 1;
}
''', [
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 24, 1),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 24, 1),
]);
}
@@ -309,7 +309,7 @@ m() {
}
''', [
error(HintCode.UNUSED_LOCAL_VARIABLE, 13, 1),
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 20, 2),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 20, 2),
]);
}
@@ -321,7 +321,7 @@ m() {
}
''', [
error(HintCode.UNUSED_LOCAL_VARIABLE, 13, 1),
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 19, 2),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 19, 2),
]);
}
@@ -357,7 +357,7 @@ f(M m) {
m++;
}
''', [
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 23, 2),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 23, 2),
]);
}
@@ -368,7 +368,7 @@ f(A a) {
a++;
}
''', [
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 23, 2),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 23, 2),
]);
}
@@ -380,7 +380,7 @@ m() {
}
''', [
error(HintCode.UNUSED_LOCAL_VARIABLE, 13, 1),
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 19, 2),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 19, 2),
]);
}
@@ -392,7 +392,7 @@ m() {
}
''', [
error(HintCode.UNUSED_LOCAL_VARIABLE, 13, 1),
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 18, 2),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 18, 2),
]);
}
@@ -428,7 +428,7 @@ f(M m) {
-m;
}
''', [
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 22, 1),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 22, 1),
]);
}
@@ -439,7 +439,7 @@ f(A a) {
++a;
}
''', [
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 22, 2),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 22, 2),
]);
}
@@ -451,7 +451,7 @@ m() {
}
''', [
error(HintCode.UNUSED_LOCAL_VARIABLE, 13, 1),
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 18, 2),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 18, 2),
]);
}
@@ -470,7 +470,7 @@ m() {
}
''', [
error(HintCode.UNUSED_LOCAL_VARIABLE, 13, 1),
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 18, 1),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 18, 1),
]);
}
}
@@ -21,7 +21,7 @@ class UndefinedPrefixedNameTest extends DriverResolutionTest {
import 'lib.dart' as p;
f() => p.c;
''', [
error(StaticTypeWarningCode.UNDEFINED_PREFIXED_NAME, 33, 1),
error(CompileTimeErrorCode.UNDEFINED_PREFIXED_NAME, 33, 1),
]);
}
@@ -33,7 +33,7 @@ f() {
p.c = 0;
}
''', [
error(StaticTypeWarningCode.UNDEFINED_PREFIXED_NAME, 34, 1),
error(CompileTimeErrorCode.UNDEFINED_PREFIXED_NAME, 34, 1),
]);
}
}
@@ -32,7 +32,7 @@ main() {
class T {}
f(T e1) { e1.m = 0; }
''', [
error(StaticTypeWarningCode.UNDEFINED_SETTER, 24, 1),
error(CompileTimeErrorCode.UNDEFINED_SETTER, 24, 1),
]);
}
@@ -42,7 +42,7 @@ mixin M {
f() { this.m = 0; }
}
''', [
error(StaticTypeWarningCode.UNDEFINED_SETTER, 23, 1),
error(CompileTimeErrorCode.UNDEFINED_SETTER, 23, 1),
]);
}
@@ -58,7 +58,7 @@ f(var a) {
}
}
''', [
error(StaticTypeWarningCode.UNDEFINED_SETTER, 80, 1),
error(CompileTimeErrorCode.UNDEFINED_SETTER, 80, 1),
]);
}
@@ -71,7 +71,7 @@ f(var a) {
}
}
''', [
error(StaticTypeWarningCode.UNDEFINED_SETTER, 43, 1),
error(CompileTimeErrorCode.UNDEFINED_SETTER, 43, 1),
]);
}
@@ -95,7 +95,7 @@ class C extends S {}
f(var p) {
f(C.s = 1);
}''', [
error(StaticTypeWarningCode.UNDEFINED_SETTER, 75, 1),
error(CompileTimeErrorCode.UNDEFINED_SETTER, 75, 1),
]);
}
@@ -104,7 +104,7 @@ f(var p) {
class A {}
f() { A.B = 0;}
''', [
error(StaticTypeWarningCode.UNDEFINED_SETTER, 19, 1),
error(CompileTimeErrorCode.UNDEFINED_SETTER, 19, 1),
]);
}
@@ -117,7 +117,7 @@ main() {
T..foo = 42;
}
''', [
error(StaticTypeWarningCode.UNDEFINED_SETTER, 54, 3),
error(CompileTimeErrorCode.UNDEFINED_SETTER, 54, 3),
]);
}
@@ -131,7 +131,7 @@ f(C c) {
c.a = 1;
}
''', [
error(StaticTypeWarningCode.UNDEFINED_SETTER, 46, 1),
error(CompileTimeErrorCode.UNDEFINED_SETTER, 46, 1),
]);
}
}
@@ -28,8 +28,7 @@ class B extends A {
}
''', [
error(
StaticTypeWarningCode
.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER,
CompileTimeErrorCode.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER,
80,
1),
]);
@@ -48,8 +47,7 @@ class B extends A {
}
''', [
error(
StaticTypeWarningCode
.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER,
CompileTimeErrorCode.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER,
72,
3),
]);
@@ -67,8 +65,7 @@ class B extends A {
}
''', [
error(
StaticTypeWarningCode
.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER,
CompileTimeErrorCode.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER,
66,
1),
]);
@@ -625,7 +625,7 @@ m(int? x) {
}
''', [
error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 58, 1),
error(StaticTypeWarningCode.UNDEFINED_GETTER, 60, 3),
error(CompileTimeErrorCode.UNDEFINED_GETTER, 60, 3),
]);
}
@@ -876,7 +876,7 @@ m(int? x) {
}
''', [
error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 54, 1),
error(StaticTypeWarningCode.UNDEFINED_METHOD, 56, 3),
error(CompileTimeErrorCode.UNDEFINED_METHOD, 56, 3),
]);
}
@@ -232,7 +232,7 @@ void main() {
''', [
// TODO(mfairhurst) suppress UNDEFINED_OPERATOR
error(HintCode.UNUSED_LOCAL_VARIABLE, 21, 1),
error(StaticTypeWarningCode.UNDEFINED_OPERATOR, 26, 1),
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 26, 1),
error(CompileTimeErrorCode.USE_OF_VOID_RESULT, 27, 1),
]);
}
@@ -582,7 +582,7 @@ dynamic main() {
return x;
}
''', [
error(StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 36, 1),
error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 36, 1),
]);
}
@@ -20,7 +20,7 @@ class WrongNumberOfTypeArgumentsTest extends DriverResolutionTest {
class A<E, F> {}
A<A> a = null;
''', [
error(StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 17, 4),
error(CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 17, 4),
]);
}
@@ -29,7 +29,7 @@ A<A> a = null;
class A<E> {}
A<A, A> a = null;
''', [
error(StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 14, 7),
error(CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 14, 7),
]);
}
@@ -39,7 +39,7 @@ class A {}
class M {}
class B<F extends num> = A<F> with M;
''', [
error(StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 47, 4),
error(CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 47, 4),
]);
}
@@ -53,7 +53,7 @@ f() {
return const C<int>();
}
''', [
error(StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 47, 6),
error(CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 47, 6),
]);
}
@@ -67,7 +67,7 @@ f() {
return const C<int>();
}
''', [
error(StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 53, 6),
error(CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 53, 6),
]);
}
@@ -81,7 +81,7 @@ f() {
return const C<int, int>();
}
''', [
error(StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 50, 11),
error(CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 50, 11),
]);
}
@@ -89,7 +89,7 @@ f() {
await assertErrorsInCode(r'''
dynamic<int> v;
''', [
error(StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 0, 12),
error(CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 0, 12),
]);
}
@@ -101,7 +101,7 @@ f() {
return new C<int>();
}
''', [
error(StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 31, 6),
error(CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 31, 6),
]);
}
@@ -113,7 +113,7 @@ f() {
return new C<int>();
}
''', [
error(StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 37, 6),
error(CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 37, 6),
]);
}
@@ -125,7 +125,7 @@ f() {
return new C<int, int>();
}
''', [
error(StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 34, 11),
error(CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 34, 11),
]);
}
@@ -138,7 +138,7 @@ main(A<int> a) {
a.element.anyGetterExistsInDynamic;
}
''', [
error(StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 36, 6),
error(CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 36, 6),
]);
}
@@ -151,7 +151,7 @@ main(A<int,int> a) {
a.element.anyGetterExistsInDynamic;
}
''', [
error(StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 33, 10),
error(CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 33, 10),
]);
}
@@ -161,7 +161,7 @@ class C<T> {
T<int> f;
}
''', [
error(StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 15, 6),
error(CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 15, 6),
]);
}
@@ -173,7 +173,7 @@ f(p) {
return p is C<A>;
}
''', [
error(StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 49, 4),
error(CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 49, 4),
]);
}
@@ -185,7 +185,7 @@ f(p) {
return p is C<A, A>;
}
''', [
error(StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 46, 7),
error(CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 46, 7),
]);
}
}
@@ -28,7 +28,7 @@ Stream<int> f() async* {
}
''',
expectedErrorsByNullability(nullable: [
error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 72, 1),
error(CompileTimeErrorCode.YIELD_OF_INVALID_TYPE, 72, 1),
], legacy: []));
}
@@ -39,7 +39,7 @@ int f() async* {
}
''', [
error(CompileTimeErrorCode.ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE, 0, 3),
error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 25, 1),
error(CompileTimeErrorCode.YIELD_OF_INVALID_TYPE, 25, 1),
]);
}
@@ -58,7 +58,7 @@ Iterable<int> f() async* {
}
''', [
error(CompileTimeErrorCode.ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE, 0, 13),
error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 35, 1),
error(CompileTimeErrorCode.YIELD_OF_INVALID_TYPE, 35, 1),
]);
}
@@ -90,7 +90,7 @@ Stream<String> f() async* {
yield 0;
}
''', [
error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 58, 1),
error(CompileTimeErrorCode.YIELD_OF_INVALID_TYPE, 58, 1),
]);
}
@@ -111,7 +111,7 @@ Iterable<int> f() sync* {
}
''',
expectedErrorsByNullability(nullable: [
error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 51, 1),
error(CompileTimeErrorCode.YIELD_OF_INVALID_TYPE, 51, 1),
], legacy: []));
}
@@ -122,7 +122,7 @@ int f() sync* {
}
''', [
error(CompileTimeErrorCode.ILLEGAL_SYNC_GENERATOR_RETURN_TYPE, 0, 3),
error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 24, 1),
error(CompileTimeErrorCode.YIELD_OF_INVALID_TYPE, 24, 1),
]);
}
@@ -156,7 +156,7 @@ Iterable<String> f() sync* {
yield 0;
}
''', [
error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 37, 1),
error(CompileTimeErrorCode.YIELD_OF_INVALID_TYPE, 37, 1),
]);
}
@@ -169,7 +169,7 @@ Stream<int> f() sync* {
}
''', [
error(CompileTimeErrorCode.ILLEGAL_SYNC_GENERATOR_RETURN_TYPE, 22, 11),
error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 54, 1),
error(CompileTimeErrorCode.YIELD_OF_INVALID_TYPE, 54, 1),
]);
}
@@ -221,7 +221,7 @@ f() async* {
yield* 0;
}
''', [
error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 22, 1),
error(CompileTimeErrorCode.YIELD_OF_INVALID_TYPE, 22, 1),
]);
}
@@ -232,7 +232,7 @@ f() async* {
yield* a;
}
''', [
error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 41, 1),
error(CompileTimeErrorCode.YIELD_OF_INVALID_TYPE, 41, 1),
]);
}
@@ -245,7 +245,7 @@ Stream<int> f() async* {
yield* a;
}
''', [
error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 75, 1),
error(CompileTimeErrorCode.YIELD_OF_INVALID_TYPE, 75, 1),
]);
}
@@ -258,7 +258,7 @@ Stream<int> f() async* {
yield* a;
}
''', [
error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 78, 1),
error(CompileTimeErrorCode.YIELD_OF_INVALID_TYPE, 78, 1),
]);
}
@@ -286,7 +286,7 @@ Stream<int> f() async* {
Stream g() => throw 0;
''',
expectedErrorsByNullability(nullable: [
error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 56, 3),
error(CompileTimeErrorCode.YIELD_OF_INVALID_TYPE, 56, 3),
], legacy: []));
}
@@ -324,7 +324,7 @@ Stream<int> f() async* {
Stream<String> g() => throw 0;
''', [
error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 56, 3),
error(CompileTimeErrorCode.YIELD_OF_INVALID_TYPE, 56, 3),
]);
}
@@ -364,7 +364,7 @@ f() sync* {
yield* 0;
}
''', [
error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 21, 1),
error(CompileTimeErrorCode.YIELD_OF_INVALID_TYPE, 21, 1),
]);
}
@@ -377,7 +377,7 @@ main() {
f;
}
''', [
error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 41, 1),
error(CompileTimeErrorCode.YIELD_OF_INVALID_TYPE, 41, 1),
]);
}
@@ -401,7 +401,7 @@ Iterable<int> f() sync* {
Iterable g() => throw 0;
''',
expectedErrorsByNullability(nullable: [
error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 35, 3),
error(CompileTimeErrorCode.YIELD_OF_INVALID_TYPE, 35, 3),
], legacy: []));
}
@@ -433,7 +433,7 @@ Iterable<int> f() sync* {
Iterable<String> g() => throw 0;
''', [
error(StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, 35, 3),
error(CompileTimeErrorCode.YIELD_OF_INVALID_TYPE, 35, 3),
]);
}
}
+1 -1
View File
@@ -80,7 +80,7 @@ analyzer:
['x']
]);
var invalid_assignment = AnalysisError(
TestSource(), 0, 1, StaticTypeWarningCode.INVALID_ASSIGNMENT, [
TestSource(), 0, 1, CompileTimeErrorCode.INVALID_ASSIGNMENT, [
['x'],
['y']
]);
+1 -1
View File
@@ -1110,7 +1110,7 @@ class OptionsTest extends BaseTest {
// missing_return: error
var undefined_function = AnalysisError(
TestSource(), 0, 1, StaticTypeWarningCode.UNDEFINED_FUNCTION, [
TestSource(), 0, 1, CompileTimeErrorCode.UNDEFINED_FUNCTION, [
['x']
]);
expect(processorFor(undefined_function).severity, ErrorSeverity.WARNING);
@@ -3,8 +3,8 @@ ERROR|COMPILE_TIME_ERROR|INCONSISTENT_INHERITANCE|lib/_internal/js_runtime/lib/i
ERROR|COMPILE_TIME_ERROR|INCONSISTENT_INHERITANCE|lib/_internal/js_runtime/lib/interceptors.dart|1659|7|5|Superinterfaces don't have a valid override for '>>': JSNumber.>> (num Function(num)), int.>> (int Function(int)).
ERROR|COMPILE_TIME_ERROR|INCONSISTENT_INHERITANCE|lib/_internal/js_runtime/lib/interceptors.dart|1659|7|5|Superinterfaces don't have a valid override for '\|': JSNumber.\| (num Function(num)), int.\| (int Function(int)).
ERROR|COMPILE_TIME_ERROR|INCONSISTENT_INHERITANCE|lib/_internal/js_runtime/lib/interceptors.dart|1659|7|5|Superinterfaces don't have a valid override for '^': JSNumber.^ (num Function(num)), int.^ (int Function(int)).
ERROR|STATIC_TYPE_WARNING|UNDEFINED_OPERATOR|lib/_internal/js_runtime/lib/interceptors.dart|1676|28|1|The operator '&' isn't defined for the type 'JSInt'.
ERROR|STATIC_TYPE_WARNING|UNDEFINED_OPERATOR|lib/_internal/js_runtime/lib/interceptors.dart|1678|27|1|The operator '&' isn't defined for the type 'JSInt'.
ERROR|STATIC_TYPE_WARNING|UNDEFINED_OPERATOR|lib/_internal/js_runtime/lib/interceptors.dart|1681|17|1|The operator '&' isn't defined for the type 'JSInt'.
ERROR|STATIC_TYPE_WARNING|UNDEFINED_OPERATOR|lib/_internal/js_runtime/lib/interceptors.dart|1686|18|1|The operator '&' isn't defined for the type 'JSInt'.
ERROR|STATIC_TYPE_WARNING|UNDEFINED_OPERATOR|lib/_internal/js_runtime/lib/interceptors.dart|1686|44|1|The operator '&' isn't defined for the type 'JSInt'.
ERROR|COMPILE_TIME_ERROR|UNDEFINED_OPERATOR|lib/_internal/js_runtime/lib/interceptors.dart|1676|28|1|The operator '&' isn't defined for the type 'JSInt'.
ERROR|COMPILE_TIME_ERROR|UNDEFINED_OPERATOR|lib/_internal/js_runtime/lib/interceptors.dart|1678|27|1|The operator '&' isn't defined for the type 'JSInt'.
ERROR|COMPILE_TIME_ERROR|UNDEFINED_OPERATOR|lib/_internal/js_runtime/lib/interceptors.dart|1681|17|1|The operator '&' isn't defined for the type 'JSInt'.
ERROR|COMPILE_TIME_ERROR|UNDEFINED_OPERATOR|lib/_internal/js_runtime/lib/interceptors.dart|1686|18|1|The operator '&' isn't defined for the type 'JSInt'.
ERROR|COMPILE_TIME_ERROR|UNDEFINED_OPERATOR|lib/_internal/js_runtime/lib/interceptors.dart|1686|44|1|The operator '&' isn't defined for the type 'JSInt'.
+1 -1
View File
@@ -31,6 +31,6 @@ void testMapDowncast() {
// [cfe] A value of type 'C' can't be assigned to a variable of type 'D?'.
dMap[d] = c;
// ^
// [analyzer] STATIC_TYPE_WARNING.INVALID_ASSIGNMENT
// [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
// [cfe] A value of type 'C' can't be assigned to a variable of type 'D?'.
}
@@ -11,7 +11,7 @@ class C {
const C.bc01(this.x, y)
: assert(staticTrue)
// ^^^^^^^^^^
// [analyzer] STATIC_TYPE_WARNING.NON_BOOL_EXPRESSION
// [analyzer] COMPILE_TIME_ERROR.NON_BOOL_EXPRESSION
// [cfe] A value of type 'bool Function()' can't be assigned to a variable of type 'bool'.
;
}

Some files were not shown because too many files have changed in this diff Show More