Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Unified Diff: pkg/analyzer/lib/src/error/codes.dart

Issue 2482573002: fix #27764, split STATIC_TYPE_ERROR into more detailed ones (Closed)
Patch Set: format Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/error/error.dart ('k') | pkg/analyzer/lib/src/task/strong/checker.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/error/codes.dart
diff --git a/pkg/analyzer/lib/src/error/codes.dart b/pkg/analyzer/lib/src/error/codes.dart
index 140c658195222779456fe4f95f7236a2f73089e4..48702e6b268fba3c33cbb677c3664a9379ec106f 100644
--- a/pkg/analyzer/lib/src/error/codes.dart
+++ b/pkg/analyzer/lib/src/error/codes.dart
@@ -4651,10 +4651,12 @@ class StaticWarningCode extends ErrorCode {
*/
class StrongModeCode extends ErrorCode {
static const String _implicitCastMessage =
- "Unsound implicit cast from '{0}' to '{1}'.";
+ "Unsafe implicit cast from '{0}' to '{1}'. "
+ "This usually indicates that type information was lost and resulted in "
+ "'dynamic' and/or a place that will have a failure at runtime.";
static const String _implicitCastCorrection =
- "Try adding an explicit cast to '{1}'.";
+ "Try adding an explicit cast to '{1}' or improving the type of '{0}'.";
static const String _invalidOverrideMessage =
"The type of '{0}.{1}' ('{2}') isn't a subtype of '{3}.{1}' ('{4}').";
@@ -4725,10 +4727,50 @@ class StrongModeCode extends ErrorCode {
static const StrongModeCode INFERRED_TYPE_CLOSURE = const StrongModeCode(
ErrorType.HINT, 'INFERRED_TYPE_CLOSURE', _inferredTypeMessage);
- static const StrongModeCode STATIC_TYPE_ERROR = const StrongModeCode(
+ static const StrongModeCode INVALID_CAST_LITERAL = const StrongModeCode(
ErrorType.COMPILE_TIME_ERROR,
- 'STATIC_TYPE_ERROR',
- "Type check failed: '{0}' ('{1}') isn't of type '{2}'.");
+ 'INVALID_CAST_LITERAL',
+ "The literal '{0}' with type '{1}' isn't of expected type '{2}'.");
+
+ static const StrongModeCode INVALID_CAST_LITERAL_LIST = const StrongModeCode(
+ ErrorType.COMPILE_TIME_ERROR,
+ 'INVALID_CAST_LITERAL_LIST',
+ "The list literal type '{0}' isn't of expected type '{1}'. The list's "
+ "type can be changed with an explicit generic type argument or by "
+ "changing the element types.");
+
+ static const StrongModeCode INVALID_CAST_LITERAL_MAP = const StrongModeCode(
+ ErrorType.COMPILE_TIME_ERROR,
+ 'INVALID_CAST_LITERAL_MAP',
+ "The map literal type '{0}' isn't of expected type '{1}'. The maps's "
+ "type can be changed with an explicit generic type arguments or by "
+ "changing the key and value types.");
+
+ static const StrongModeCode INVALID_CAST_FUNCTION_EXPR = const StrongModeCode(
+ ErrorType.COMPILE_TIME_ERROR,
+ 'INVALID_CAST_FUNCTION_EXPR',
+ "The function expression type '{0}' isn't of type '{1}'. "
+ "This means its parameter or return type does not match what is "
+ "expected. Consider changing parameter type(s) or the returned type(s).");
+
+ static const StrongModeCode INVALID_CAST_NEW_EXPR = const StrongModeCode(
+ ErrorType.COMPILE_TIME_ERROR,
+ 'INVALID_CAST_NEW_EXPR',
+ "The constructor returns type '{0}' that isn't of expected type '{1}'.");
+
+ static const StrongModeCode INVALID_CAST_METHOD = const StrongModeCode(
+ ErrorType.COMPILE_TIME_ERROR,
+ 'INVALID_CAST_METHOD',
+ "The method tear-off '{0}' has type '{1}' that isn't of expected type "
+ "'{2}'. This means its parameter or return type does not match what is "
+ "expected.");
+
+ static const StrongModeCode INVALID_CAST_FUNCTION = const StrongModeCode(
+ ErrorType.COMPILE_TIME_ERROR,
+ 'INVALID_CAST_FUNCTION',
+ "The function '{0}' has type '{1}' that isn't of expected type "
+ "'{2}'. This means its parameter or return type does not match what is "
+ "expected.");
static const StrongModeCode INVALID_SUPER_INVOCATION = const StrongModeCode(
ErrorType.COMPILE_TIME_ERROR,
« no previous file with comments | « pkg/analyzer/lib/error/error.dart ('k') | pkg/analyzer/lib/src/task/strong/checker.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698