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

Side by Side Diff: pkg/compiler/lib/src/diagnostics/messages.dart

Issue 2699073003: Support `void` as generic argument.
Patch Set: Add specialized messages for `void` for-ins. Created 3 years, 9 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/elements/resolution_types.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 /** 5 /**
6 * The messages in this file should meet the following guide lines: 6 * The messages in this file should meet the following guide lines:
7 * 7 *
8 * 1. The message should be a complete sentence starting with an uppercase 8 * 1. The message should be a complete sentence starting with an uppercase
9 * letter, and ending with a period. 9 * letter, and ending with a period.
10 * 10 *
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 ASSERT_IS_GIVEN_NAMED_ARGUMENTS, 85 ASSERT_IS_GIVEN_NAMED_ARGUMENTS,
86 ASSIGNING_FINAL_FIELD_IN_SUPER, 86 ASSIGNING_FINAL_FIELD_IN_SUPER,
87 ASSIGNING_METHOD, 87 ASSIGNING_METHOD,
88 ASSIGNING_METHOD_IN_SUPER, 88 ASSIGNING_METHOD_IN_SUPER,
89 ASSIGNING_TYPE, 89 ASSIGNING_TYPE,
90 ASYNC_AWAIT_NOT_SUPPORTED, 90 ASYNC_AWAIT_NOT_SUPPORTED,
91 ASYNC_KEYWORD_AS_IDENTIFIER, 91 ASYNC_KEYWORD_AS_IDENTIFIER,
92 ASYNC_MODIFIER_ON_ABSTRACT_METHOD, 92 ASYNC_MODIFIER_ON_ABSTRACT_METHOD,
93 ASYNC_MODIFIER_ON_CONSTRUCTOR, 93 ASYNC_MODIFIER_ON_CONSTRUCTOR,
94 ASYNC_MODIFIER_ON_SETTER, 94 ASYNC_MODIFIER_ON_SETTER,
95 AWAIT_FORIN_VOID_GENERIC,
95 AWAIT_MEMBER_NOT_FOUND, 96 AWAIT_MEMBER_NOT_FOUND,
96 AWAIT_MEMBER_NOT_FOUND_IN_CLOSURE, 97 AWAIT_MEMBER_NOT_FOUND_IN_CLOSURE,
97 BAD_INPUT_CHARACTER, 98 BAD_INPUT_CHARACTER,
98 BEFORE_TOP_LEVEL, 99 BEFORE_TOP_LEVEL,
99 BINARY_OPERATOR_BAD_ARITY, 100 BINARY_OPERATOR_BAD_ARITY,
100 BODY_EXPECTED, 101 BODY_EXPECTED,
101 CANNOT_EXTEND, 102 CANNOT_EXTEND,
102 CANNOT_EXTEND_ENUM, 103 CANNOT_EXTEND_ENUM,
103 CANNOT_EXTEND_MALFORMED, 104 CANNOT_EXTEND_MALFORMED,
104 CANNOT_FIND_CONSTRUCTOR, 105 CANNOT_FIND_CONSTRUCTOR,
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 EXPORT_BEFORE_PARTS, 195 EXPORT_BEFORE_PARTS,
195 EXTERNAL_WITH_BODY, 196 EXTERNAL_WITH_BODY,
196 EXTRA_CATCH_DECLARATION, 197 EXTRA_CATCH_DECLARATION,
197 EXTRA_FORMALS, 198 EXTRA_FORMALS,
198 EXTRANEOUS_MODIFIER, 199 EXTRANEOUS_MODIFIER,
199 EXTRANEOUS_MODIFIER_REPLACE, 200 EXTRANEOUS_MODIFIER_REPLACE,
200 FACTORY_REDIRECTION_IN_NON_FACTORY, 201 FACTORY_REDIRECTION_IN_NON_FACTORY,
201 FINAL_FUNCTION_TYPE_PARAMETER, 202 FINAL_FUNCTION_TYPE_PARAMETER,
202 FINAL_WITHOUT_INITIALIZER, 203 FINAL_WITHOUT_INITIALIZER,
203 FORIN_NOT_ASSIGNABLE, 204 FORIN_NOT_ASSIGNABLE,
205 FORIN_VOID_GENERIC,
204 FORMAL_DECLARED_CONST, 206 FORMAL_DECLARED_CONST,
205 FORMAL_DECLARED_STATIC, 207 FORMAL_DECLARED_STATIC,
206 FUNCTION_TYPE_FORMAL_WITH_DEFAULT, 208 FUNCTION_TYPE_FORMAL_WITH_DEFAULT,
207 FUNCTION_WITH_INITIALIZER, 209 FUNCTION_WITH_INITIALIZER,
208 GENERIC, 210 GENERIC,
209 GETTER_MISMATCH, 211 GETTER_MISMATCH,
210 UNDEFINED_INSTANCE_GETTER_BUT_SETTER, 212 UNDEFINED_INSTANCE_GETTER_BUT_SETTER,
211 HEX_DIGIT_EXPECTED, 213 HEX_DIGIT_EXPECTED,
212 HIDDEN_HINTS, 214 HIDDEN_HINTS,
213 HIDDEN_IMPLICIT_IMPORT, 215 HIDDEN_IMPLICIT_IMPORT,
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 /// 4 of the guide lines for error messages in the beginning of the file. 516 /// 4 of the guide lines for error messages in the beginning of the file.
515 MessageKind.GENERIC: 517 MessageKind.GENERIC:
516 const MessageTemplate(MessageKind.GENERIC, '#{text}'), 518 const MessageTemplate(MessageKind.GENERIC, '#{text}'),
517 519
518 MessageKind.VOID_EXPRESSION: const MessageTemplate( 520 MessageKind.VOID_EXPRESSION: const MessageTemplate(
519 MessageKind.VOID_EXPRESSION, "Expression does not yield a value."), 521 MessageKind.VOID_EXPRESSION, "Expression does not yield a value."),
520 522
521 MessageKind.VOID_VARIABLE: const MessageTemplate( 523 MessageKind.VOID_VARIABLE: const MessageTemplate(
522 MessageKind.VOID_VARIABLE, "Variable cannot be of type void."), 524 MessageKind.VOID_VARIABLE, "Variable cannot be of type void."),
523 525
526 MessageKind.FORIN_VOID_GENERIC: const MessageTemplate(
527 MessageKind.FORIN_VOID_GENERIC,
528 "Generic type of Iterable cannot be of type void.",
529 howToFix: "Try casting the iterable.",
Siggi Cherem (dart-lang) 2017/03/13 22:50:58 can a cast succeed? Doesn't this error imply that
floitsch 2017/03/14 13:30:49 Removed the "howToFix". There doesn't seem to be a
530 examples: const [
531 """
532 main() {
533 for (var x in new List<void>()) {
534 }
535 }
536 """
537 ]),
538
524 MessageKind.RETURN_VALUE_IN_VOID: const MessageTemplate( 539 MessageKind.RETURN_VALUE_IN_VOID: const MessageTemplate(
525 MessageKind.RETURN_VALUE_IN_VOID, 540 MessageKind.RETURN_VALUE_IN_VOID,
526 "Cannot return value from void function."), 541 "Cannot return value from void function."),
527 542
528 MessageKind.RETURN_NOTHING: const MessageTemplate( 543 MessageKind.RETURN_NOTHING: const MessageTemplate(
529 MessageKind.RETURN_NOTHING, 544 MessageKind.RETURN_NOTHING,
530 "Value of type '#{returnType}' expected."), 545 "Value of type '#{returnType}' expected."),
531 546
532 MessageKind.MISSING_ARGUMENT: const MessageTemplate( 547 MessageKind.MISSING_ARGUMENT: const MessageTemplate(
533 MessageKind.MISSING_ARGUMENT, 548 MessageKind.MISSING_ARGUMENT,
534 "Missing argument of type '#{argumentType}'."), 549 "Missing argument of type '#{argumentType}'."),
535 550
536 MessageKind.ADDITIONAL_ARGUMENT: const MessageTemplate( 551 MessageKind.ADDITIONAL_ARGUMENT: const MessageTemplate(
537 MessageKind.ADDITIONAL_ARGUMENT, "Additional argument."), 552 MessageKind.ADDITIONAL_ARGUMENT, "Additional argument."),
538 553
539 MessageKind.NAMED_ARGUMENT_NOT_FOUND: const MessageTemplate( 554 MessageKind.NAMED_ARGUMENT_NOT_FOUND: const MessageTemplate(
540 MessageKind.NAMED_ARGUMENT_NOT_FOUND, 555 MessageKind.NAMED_ARGUMENT_NOT_FOUND,
541 "No named argument '#{argumentName}' found on method."), 556 "No named argument '#{argumentName}' found on method."),
542 557
558 MessageKind.AWAIT_FORIN_VOID_GENERIC: const MessageTemplate(
559 MessageKind.AWAIT_FORIN_VOID_GENERIC,
560 "Generic type of Stream cannot be of type void.",
561 howToFix: "Try casting the stream.",
Siggi Cherem (dart-lang) 2017/03/13 22:50:58 same
floitsch 2017/03/14 13:30:49 ditto.
562 examples: const [
563 """
564 import 'dart:async';
565 main() async {
566 await for (var x in new StreamView<void>(null)) {
567 }
568 }
569 """
570 ]),
571
543 MessageKind.AWAIT_MEMBER_NOT_FOUND: const MessageTemplate( 572 MessageKind.AWAIT_MEMBER_NOT_FOUND: const MessageTemplate(
544 MessageKind.AWAIT_MEMBER_NOT_FOUND, 573 MessageKind.AWAIT_MEMBER_NOT_FOUND,
545 "No member named 'await' in class '#{className}'.", 574 "No member named 'await' in class '#{className}'.",
546 howToFix: "Did you mean to add the 'async' marker " 575 howToFix: "Did you mean to add the 'async' marker "
547 "to '#{functionName}'?", 576 "to '#{functionName}'?",
548 examples: const [ 577 examples: const [
549 """ 578 """
550 class A { 579 class A {
551 m() => await -3; 580 m() => await -3;
552 } 581 }
(...skipping 3265 matching lines...) Expand 10 before | Expand all | Expand 10 after
3818 static String convertToString(value) { 3847 static String convertToString(value) {
3819 if (value is ErrorToken) { 3848 if (value is ErrorToken) {
3820 // Shouldn't happen. 3849 // Shouldn't happen.
3821 return value.assertionMessage; 3850 return value.assertionMessage;
3822 } else if (value is Token) { 3851 } else if (value is Token) {
3823 value = value.value; 3852 value = value.value;
3824 } 3853 }
3825 return '$value'; 3854 return '$value';
3826 } 3855 }
3827 } 3856 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/elements/resolution_types.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698