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

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

Issue 24267002: Emit compile-time error on 'const' formal parameters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 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 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 543
544 main() { 544 main() {
545 F f; 545 F f;
546 }""", """ 546 }""", """
547 typedef void F({int arg: 0}); 547 typedef void F({int arg: 0});
548 548
549 main() { 549 main() {
550 F f; 550 F f;
551 }"""]); 551 }"""]);
552 552
553 static const MessageKind FORMAL_DECLARED_CONST = const MessageKind(
554 "Error: A formal parameter can't be declared const.",
555 howToFix: "Try removing 'const'.",
556 examples: const ["""
557 foo(const x) {}
558 main() => foo(42);
559 """, """
560 foo({const x}) {}
561 main() => foo(42);
562 """, """
563 foo([const x]) {}
564 main() => foo(42);
565 """]);
566
553 static const MessageKind CANNOT_INSTANTIATE_TYPE_VARIABLE = const MessageKind( 567 static const MessageKind CANNOT_INSTANTIATE_TYPE_VARIABLE = const MessageKind(
554 'Error: Cannot instantiate type variable "#{typeVariableName}".'); 568 'Error: Cannot instantiate type variable "#{typeVariableName}".');
555 569
556 static const MessageKind CYCLIC_TYPE_VARIABLE = const MessageKind( 570 static const MessageKind CYCLIC_TYPE_VARIABLE = const MessageKind(
557 'Warning: Type variable "#{typeVariableName}" is a supertype of itself.'); 571 'Warning: Type variable "#{typeVariableName}" is a supertype of itself.');
558 572
559 static const CYCLIC_TYPEDEF = const MessageKind( 573 static const CYCLIC_TYPEDEF = const MessageKind(
560 "Error: A typedef can't refer to itself.", 574 "Error: A typedef can't refer to itself.",
561 howToFix: "Try removing all references to '#{typedefName}' " 575 howToFix: "Try removing all references to '#{typedefName}' "
562 "in the definition of '#{typedefName}'.", 576 "in the definition of '#{typedefName}'.",
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 1278
1265 class CompileTimeConstantError extends Diagnostic { 1279 class CompileTimeConstantError extends Diagnostic {
1266 CompileTimeConstantError(MessageKind kind, Map arguments, bool terse) 1280 CompileTimeConstantError(MessageKind kind, Map arguments, bool terse)
1267 : super(kind, arguments, terse); 1281 : super(kind, arguments, terse);
1268 } 1282 }
1269 1283
1270 class CompilationError extends Diagnostic { 1284 class CompilationError extends Diagnostic {
1271 CompilationError(MessageKind kind, Map arguments, bool terse) 1285 CompilationError(MessageKind kind, Map arguments, bool terse)
1272 : super(kind, arguments, terse); 1286 : super(kind, arguments, terse);
1273 } 1287 }
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