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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/warnings.dart

Issue 25023002: Emit a compile-time error if a function type parameter is declard with 'final' or 'var'. (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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart2js; 5 part of dart2js;
6 6
7 const DONT_KNOW_HOW_TO_FIX = ""; 7 const DONT_KNOW_HOW_TO_FIX = "";
8 8
9 /** 9 /**
10 * The messages in this file should meet the following guide lines: 10 * The messages in this file should meet the following guide lines:
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 foo(static x) {} 592 foo(static x) {}
593 main() => foo(42); 593 main() => foo(42);
594 """, """ 594 """, """
595 foo({static x}) {} 595 foo({static x}) {}
596 main() => foo(42); 596 main() => foo(42);
597 """, """ 597 """, """
598 foo([static x]) {} 598 foo([static x]) {}
599 main() => foo(42); 599 main() => foo(42);
600 """]); 600 """]);
601 601
602 static const MessageKind FINAL_FUNCTION_TYPE_PARAMETER = const MessageKind(
603 "Error: A function type parameter can't be declared final.",
604 howToFix: "Try removing 'final'.",
605 examples: const ["""
606 foo(final int x(int a)) {}
607 main() => foo((y) => 42);
608 """, """
609 foo({final int x(int a)}) {}
610 main() => foo((y) => 42);
611 """, """
612 foo([final int x(int a)]) {}
613 main() => foo((y) => 42);
614 """]);
615
616 static const MessageKind VAR_FUNCTION_TYPE_PARAMETER = const MessageKind(
617 "Error: A function type parameter can't be declared with 'var'.",
618 howToFix: "Try removing 'var'.",
619 examples: const ["""
620 foo(var int x(int a)) {}
621 main() => foo((y) => 42);
622 """, """
623 foo({var int x(int a)}) {}
624 main() => foo((y) => 42);
625 """, """
626 foo([var int x(int a)]) {}
627 main() => foo((y) => 42);
628 """]);
629
602 static const MessageKind CANNOT_INSTANTIATE_TYPE_VARIABLE = const MessageKind( 630 static const MessageKind CANNOT_INSTANTIATE_TYPE_VARIABLE = const MessageKind(
603 "Error: Cannot instantiate type variable '#{typeVariableName}'."); 631 "Error: Cannot instantiate type variable '#{typeVariableName}'.");
604 632
605 static const MessageKind CYCLIC_TYPE_VARIABLE = const MessageKind( 633 static const MessageKind CYCLIC_TYPE_VARIABLE = const MessageKind(
606 "Warning: Type variable '#{typeVariableName}' is a supertype of itself."); 634 "Warning: Type variable '#{typeVariableName}' is a supertype of itself.");
607 635
608 static const CYCLIC_TYPEDEF = const MessageKind( 636 static const CYCLIC_TYPEDEF = const MessageKind(
609 "Error: A typedef can't refer to itself.", 637 "Error: A typedef can't refer to itself.",
610 howToFix: "Try removing all references to '#{typedefName}' " 638 howToFix: "Try removing all references to '#{typedefName}' "
611 "in the definition of '#{typedefName}'.", 639 "in the definition of '#{typedefName}'.",
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
1334 1362
1335 class CompileTimeConstantError extends Diagnostic { 1363 class CompileTimeConstantError extends Diagnostic {
1336 CompileTimeConstantError(MessageKind kind, Map arguments, bool terse) 1364 CompileTimeConstantError(MessageKind kind, Map arguments, bool terse)
1337 : super(kind, arguments, terse); 1365 : super(kind, arguments, terse);
1338 } 1366 }
1339 1367
1340 class CompilationError extends Diagnostic { 1368 class CompilationError extends Diagnostic {
1341 CompilationError(MessageKind kind, Map arguments, bool terse) 1369 CompilationError(MessageKind kind, Map arguments, bool terse)
1342 : super(kind, arguments, terse); 1370 : super(kind, arguments, terse);
1343 } 1371 }
OLDNEW
« 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