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 6424772cfe7aabfff580b8a65835ba917077deb6..74582dd1191f65415e77090e6993e86a217bff66 100644 |
--- a/pkg/compiler/lib/src/diagnostics/messages.dart |
+++ b/pkg/compiler/lib/src/diagnostics/messages.dart |
@@ -155,6 +155,7 @@ enum MessageKind { |
FORIN_NOT_ASSIGNABLE, |
FORMAL_DECLARED_CONST, |
FORMAL_DECLARED_STATIC, |
+ FROM_ENVIRONMENT_MUST_BE_CONST, |
FUNCTION_TYPE_FORMAL_WITH_DEFAULT, |
FUNCTION_WITH_INITIALIZER, |
GENERIC, |
@@ -1078,6 +1079,13 @@ main() => new C(0);""" |
"This const constructor is not allowed due to " |
"non-final fields."), |
+ MessageKind.FROM_ENVIRONMENT_MUST_BE_CONST: const MessageTemplate( |
+ MessageKind.FROM_ENVIRONMENT_MUST_BE_CONST, |
+ "#{className}.fromEnvironment can only be used as a " |
+ "const constructor.", |
+ howToFix: "Try replacing `new` with `const`.", |
+ examples: const ["main() { new bool.fromEnvironment('X'); }"]), |
+ |
MessageKind.INITIALIZING_FORMAL_NOT_ALLOWED: const MessageTemplate( |
MessageKind.INITIALIZING_FORMAL_NOT_ALLOWED, |
"Initializing formal parameter only allowed in generative " |