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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/src/elements/resolution_types.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/diagnostics/messages.dart
diff --git a/pkg/compiler/lib/src/diagnostics/messages.dart b/pkg/compiler/lib/src/diagnostics/messages.dart
index 751ffe73f3af36d6ee4fcae4281157b17cee748e..a49c24531bb4648899eed6a0e7cb0bb8693def33 100644
--- a/pkg/compiler/lib/src/diagnostics/messages.dart
+++ b/pkg/compiler/lib/src/diagnostics/messages.dart
@@ -92,6 +92,7 @@ enum MessageKind {
ASYNC_MODIFIER_ON_ABSTRACT_METHOD,
ASYNC_MODIFIER_ON_CONSTRUCTOR,
ASYNC_MODIFIER_ON_SETTER,
+ AWAIT_FORIN_VOID_GENERIC,
AWAIT_MEMBER_NOT_FOUND,
AWAIT_MEMBER_NOT_FOUND_IN_CLOSURE,
BAD_INPUT_CHARACTER,
@@ -201,6 +202,7 @@ enum MessageKind {
FINAL_FUNCTION_TYPE_PARAMETER,
FINAL_WITHOUT_INITIALIZER,
FORIN_NOT_ASSIGNABLE,
+ FORIN_VOID_GENERIC,
FORMAL_DECLARED_CONST,
FORMAL_DECLARED_STATIC,
FUNCTION_TYPE_FORMAL_WITH_DEFAULT,
@@ -521,6 +523,19 @@ class MessageTemplate {
MessageKind.VOID_VARIABLE: const MessageTemplate(
MessageKind.VOID_VARIABLE, "Variable cannot be of type void."),
+ MessageKind.FORIN_VOID_GENERIC: const MessageTemplate(
+ MessageKind.FORIN_VOID_GENERIC,
+ "Generic type of Iterable cannot be of type void.",
+ 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
+ examples: const [
+ """
+main() {
+ for (var x in new List<void>()) {
+ }
+}
+"""
+ ]),
+
MessageKind.RETURN_VALUE_IN_VOID: const MessageTemplate(
MessageKind.RETURN_VALUE_IN_VOID,
"Cannot return value from void function."),
@@ -540,6 +555,20 @@ class MessageTemplate {
MessageKind.NAMED_ARGUMENT_NOT_FOUND,
"No named argument '#{argumentName}' found on method."),
+ MessageKind.AWAIT_FORIN_VOID_GENERIC: const MessageTemplate(
+ MessageKind.AWAIT_FORIN_VOID_GENERIC,
+ "Generic type of Stream cannot be of type void.",
+ howToFix: "Try casting the stream.",
Siggi Cherem (dart-lang) 2017/03/13 22:50:58 same
floitsch 2017/03/14 13:30:49 ditto.
+ examples: const [
+ """
+import 'dart:async';
+main() async {
+ await for (var x in new StreamView<void>(null)) {
+ }
+}
+"""
+ ]),
+
MessageKind.AWAIT_MEMBER_NOT_FOUND: const MessageTemplate(
MessageKind.AWAIT_MEMBER_NOT_FOUND,
"No member named 'await' in class '#{className}'.",
« 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