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

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

Issue 34993002: Check const expressions for malformed types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Status updated 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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 520
521 static const DualKind TYPE_VARIABLE_WITHIN_STATIC_MEMBER = const DualKind( 521 static const DualKind TYPE_VARIABLE_WITHIN_STATIC_MEMBER = const DualKind(
522 error: const MessageKind( 522 error: const MessageKind(
523 "Error: Cannot refer to type variable '#{typeVariableName}' " 523 "Error: Cannot refer to type variable '#{typeVariableName}' "
524 "within a static member."), 524 "within a static member."),
525 warning: const MessageKind( 525 warning: const MessageKind(
526 "Warning: Cannot refer to type variable '#{typeVariableName}' " 526 "Warning: Cannot refer to type variable '#{typeVariableName}' "
527 "within a static member.")); 527 "within a static member."));
528 528
529 static const MessageKind TYPE_VARIABLE_IN_CONSTANT = const MessageKind( 529 static const MessageKind TYPE_VARIABLE_IN_CONSTANT = const MessageKind(
530 "Error: Cannot refer to type variable in constant."); 530 "Error: Constant expressions can't refer to type variables.",
531 howToFix: "Try removing the type variable or replacing it with a "
532 "concrete type.",
533 examples: const ["""
534 class C<T> {
535 const C();
536
537 m(T t) => const C<T>();
538 }
539
540 void main() => new C().m(null);
541 """
542 ]);
543
531 544
532 static const MessageKind INVALID_TYPE_VARIABLE_BOUND = const MessageKind( 545 static const MessageKind INVALID_TYPE_VARIABLE_BOUND = const MessageKind(
533 "Warning: '#{typeArgument}' is not a subtype of bound '#{bound}' for " 546 "Warning: '#{typeArgument}' is not a subtype of bound '#{bound}' for "
534 "type variable '#{typeVariable}' of type '#{thisType}'.", 547 "type variable '#{typeVariable}' of type '#{thisType}'.",
535 howToFix: "Try to change or remove the type argument.", 548 howToFix: "Try to change or remove the type argument.",
536 examples: const [""" 549 examples: const ["""
537 class C<T extends num> {} 550 class C<T extends num> {}
538 551
539 // 'String' is not a valid instantiation of T with bound num.'. 552 // 'String' is not a valid instantiation of T with bound num.'.
540 main() => new C<String>(); 553 main() => new C<String>();
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after
1521 1534
1522 class CompileTimeConstantError extends Diagnostic { 1535 class CompileTimeConstantError extends Diagnostic {
1523 CompileTimeConstantError(MessageKind kind, Map arguments, bool terse) 1536 CompileTimeConstantError(MessageKind kind, Map arguments, bool terse)
1524 : super(kind, arguments, terse); 1537 : super(kind, arguments, terse);
1525 } 1538 }
1526 1539
1527 class CompilationError extends Diagnostic { 1540 class CompilationError extends Diagnostic {
1528 CompilationError(MessageKind kind, Map arguments, bool terse) 1541 CompilationError(MessageKind kind, Map arguments, bool terse)
1529 : super(kind, arguments, terse); 1542 : super(kind, arguments, terse);
1530 } 1543 }
OLDNEW
« 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