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

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

Issue 24073002: Emit error on default values in typedefs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add a test for named arguments. Created 7 years, 3 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-dart2dart.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 c108cf83ab36a965fee6166061a65fefb4c3a005..b55b0260f8c9119bd7be78b587d3f1e44eabf6f2 100644
--- a/sdk/lib/_internal/compiler/implementation/warnings.dart
+++ b/sdk/lib/_internal/compiler/implementation/warnings.dart
@@ -418,6 +418,21 @@ main() => new C(0);"""]);
static const MessageKind CANNOT_INSTANTIATE_TYPEDEF = const MessageKind(
'Error: Cannot instantiate typedef "#{typedefName}".');
+ static const MessageKind TYPEDEF_FORMAL_WITH_DEFAULT = const MessageKind(
+ "Error: A parameter of a typedef can't specify a default value.",
+ howToFix: "Remove the default value.",
+ examples: const ["""
+typedef void F([int arg = 0]);
+
+main() {
+ F f;
+}""", """
+typedef void F({int arg: 0});
+
+main() {
+ F f;
+}"""]);
+
static const MessageKind CANNOT_INSTANTIATE_TYPE_VARIABLE = const MessageKind(
'Error: Cannot instantiate type variable "#{typeVariableName}".');
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/resolution/members.dart ('k') | tests/co19/co19-dart2dart.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698