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

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: 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
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..ee6857700570084f52a57f7b5382b181af19fbb1 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 must be either a reference to a compile-time constant "
karlklose 2015/12/09 14:07:29 'A metadata annotation' or 'Metadata'.
Johnni Winther 2015/12/09 14:43:43 Done.
+ "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 call to a constant constructor cannot use type "
karlklose 2015/12/09 14:07:29 'Metadata annotation using a constant ...'
Johnni Winther 2015/12/09 14:43:43 Done.
+ "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') | pkg/compiler/lib/src/resolution/resolution.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698