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

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

Issue 26370004: Emit a compile-time error when using default values in function typed parameter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 a7d664275bce935e3dea3361b3135d3807bbdf01..ad09f95f26a83f210d538e66cca81cf6c0349668 100644
--- a/sdk/lib/_internal/compiler/implementation/warnings.dart
+++ b/sdk/lib/_internal/compiler/implementation/warnings.dart
@@ -587,7 +587,7 @@ main() {
static const MessageKind TYPEDEF_FORMAL_WITH_DEFAULT = const MessageKind(
"Error: A parameter of a typedef can't specify a default value.",
howToFix:
- "Try removing the default value or making the parameter optional.",
+ "Try removing the default value.",
examples: const ["""
typedef void F([int arg = 0]);
@@ -600,6 +600,22 @@ main() {
F f;
}"""]);
+ static const MessageKind FUNCTION_TYPE_FORMAL_WITH_DEFAULT = const MessageKind(
+ "Error: A function type parameters can't specify a default value.",
+ howToFix:
+ "Try removing the default value.",
+ examples: const ["""
+foo(void f(int i, [a = 1]) {}
+
+main() {
+ foo(1, 2);
+}""", """
+foo(void f(int i, {a: 1}) {}
+
+main() {
+ foo(1, a: 2);
+}"""]);
+
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