Index: pkg/compiler/lib/src/diagnostics/messages.dart |
diff --git a/pkg/compiler/lib/src/diagnostics/messages.dart b/pkg/compiler/lib/src/diagnostics/messages.dart |
index e17157442c72e8251650e482d8a175d88d0797aa..d93ef4dad3b003b0a7a0b03bc46d0ea574aae8eb 100644 |
--- a/pkg/compiler/lib/src/diagnostics/messages.dart |
+++ b/pkg/compiler/lib/src/diagnostics/messages.dart |
@@ -431,6 +431,7 @@ enum MessageKind { |
TYPE_VARIABLE_IN_CONSTANT, |
TYPE_VARIABLE_WITHIN_STATIC_MEMBER, |
TYPE_VARIABLE_FROM_METHOD_NOT_REIFIED, |
+ TYPE_VARIABLE_FROM_METHOD_CONSIDERED_DYNAMIC, |
TYPEDEF_FORMAL_WITH_DEFAULT, |
UNARY_OPERATOR_BAD_ARITY, |
UNBOUND_LABEL, |
@@ -1233,7 +1234,17 @@ main() => f<int>(); |
bool f<T>(Object o) => o is T; |
main() => f<int>(42); |
-""", |
+""" |
+ ]), |
+ |
+ MessageKind.TYPE_VARIABLE_FROM_METHOD_CONSIDERED_DYNAMIC: |
+ const MessageTemplate( |
+ MessageKind.TYPE_VARIABLE_FROM_METHOD_CONSIDERED_DYNAMIC, |
+ "Method type variables are treated as `dynamic` in `as` expressions.", |
+ options: const ["--generic-method-syntax"], |
+ howToFix: "Try using the upper bound of the type variable, or check " |
+ "that the blind success of the test does not introduce bugs.", |
+ examples: const [ |
""" |
// Method type variables are not reified, so they cannot be tested dynamically. |
bool f<T>(Object o) => o as T; |