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

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

Issue 1510863004: Report compile-time error on disallowed metadata values. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years 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/resolution.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 31c7070dbead320300f78db035e3b1ec026b1055..d0aafc536ede7550f144d1d5ec1142bb48d02866 100644
--- a/pkg/compiler/lib/src/diagnostics/messages.dart
+++ b/pkg/compiler/lib/src/diagnostics/messages.dart
@@ -256,6 +256,8 @@ enum MessageKind {
INVALID_CONTINUE,
INVALID_FOR_IN,
INVALID_INITIALIZER,
+ INVALID_METADATA,
+ INVALID_METADATA_GENERIC,
INVALID_OVERRIDDEN_FIELD,
INVALID_OVERRIDDEN_GETTER,
INVALID_OVERRIDDEN_METHOD,
@@ -2866,6 +2868,31 @@ main() => new C();
"The getter '#{name}' is implicitly declared by this field "
"in class '#{class}'."),
+ MessageKind.INVALID_METADATA:
+ const MessageTemplate(MessageKind.INVALID_METADATA,
+ "A metadata annotation must be either a reference to a compile-time "
+ "constant variable or a call to a constant constructor.",
+ howToFix:
+ "Try using a different constant value or referencing it through a "
+ "constant variable.",
+ examples: const [
+'@Object main() {}',
+'@print main() {}']),
+
+ MessageKind.INVALID_METADATA_GENERIC:
+ const MessageTemplate(MessageKind.INVALID_METADATA_GENERIC,
+ "A metadata annotation using a constant constructor cannot use type "
+ "arguments.",
+ howToFix:
+ "Try removing the type arguments or referencing the constant "
+ "through a constant variable.",
+ examples: const ['''
+class C<T> {
+ const C();
+}
+@C<int>() main() {}
+''']),
+
MessageKind.EQUAL_MAP_ENTRY_KEY:
const MessageTemplate(MessageKind.EQUAL_MAP_ENTRY_KEY,
"An entry with the same key already exists in the map.",
« no previous file with comments | « no previous file | pkg/compiler/lib/src/resolution/resolution.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698