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

Unified Diff: pkg/compiler/lib/src/diagnostics/messages.dart

Issue 2388843002: Relaxes treatment of method type parameter in `as` expressions. (Closed)
Patch Set: Simplifies `o as T` check for `T` method type parameter. Created 4 years, 2 months 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 | « no previous file | pkg/compiler/lib/src/resolution/members.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | pkg/compiler/lib/src/resolution/members.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698