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

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

Issue 51843005: Emit a compile-time error when using default values in a redirecting factory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Language status changes. 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 4b2d1c7ac56e3100e157c502eb085f3e138dc851..fe1217679416383de8e343ccef32d28b1509cab9 100644
--- a/sdk/lib/_internal/compiler/implementation/warnings.dart
+++ b/sdk/lib/_internal/compiler/implementation/warnings.dart
@@ -644,7 +644,7 @@ main() {
}"""]);
static const MessageKind FUNCTION_TYPE_FORMAL_WITH_DEFAULT = const MessageKind(
- "Error: A function type parameters can't specify a default value.",
+ "Error: A function type parameter can't specify a default value.",
howToFix:
"Try removing the default value.",
examples: const ["""
@@ -659,6 +659,29 @@ main() {
foo(1, a: 2);
}"""]);
+ static const MessageKind REDIRECTING_FACTORY_WITH_DEFAULT = const MessageKind(
+ "Error: A parameter of a redirecting factory constructor can't specify a "
+ "default value.",
+ howToFix:
+ "Try removing the default value.",
+ examples: const ["""
+class A {
+ A([a]);
+ factory A.foo([a = 1]) = A;
+}
+
+main() {
+ new A.foo(1);
+}""", """
+class A {
+ A({a});
+ factory A.foo({a: 1}) = A;
+}
+
+main() {
+ new A.foo(a: 1);
+}"""]);
+
static const MessageKind FORMAL_DECLARED_CONST = const MessageKind(
"Error: A formal parameter can't be declared const.",
howToFix: "Try removing 'const'.",
« 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