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

Unified Diff: sdk/lib/_internal/compiler/implementation/warnings.dart

Issue 34993002: Check const expressions for malformed types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Status updated Created 7 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 | « sdk/lib/_internal/compiler/implementation/resolution/members.dart ('k') | tests/co19/co19-dart2js.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/warnings.dart
diff --git a/sdk/lib/_internal/compiler/implementation/warnings.dart b/sdk/lib/_internal/compiler/implementation/warnings.dart
index 45803c190a41f09ecac762152cd38093f47a27ac..fb33d49c1e11ecdec11f809c0cd70d52441fd712 100644
--- a/sdk/lib/_internal/compiler/implementation/warnings.dart
+++ b/sdk/lib/_internal/compiler/implementation/warnings.dart
@@ -527,7 +527,20 @@ main() => new C(0);"""]);
"within a static member."));
static const MessageKind TYPE_VARIABLE_IN_CONSTANT = const MessageKind(
- "Error: Cannot refer to type variable in constant.");
+ "Error: Constant expressions can't refer to type variables.",
+ howToFix: "Try removing the type variable or replacing it with a "
+ "concrete type.",
+ examples: const ["""
+class C<T> {
+ const C();
+
+ m(T t) => const C<T>();
+}
+
+void main() => new C().m(null);
+"""
+]);
+
static const MessageKind INVALID_TYPE_VARIABLE_BOUND = const MessageKind(
"Warning: '#{typeArgument}' is not a subtype of bound '#{bound}' for "
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/resolution/members.dart ('k') | tests/co19/co19-dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698