-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
cfe-dysfunctionalitiesIssues for the CFE not behaving as intendedIssues for the CFE not behaving as intendedlegacy-area-front-endLegacy: Use area-dart-model instead.Legacy: Use area-dart-model instead.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)
Description
In the language specification we have:
It is a compile-time error for a for-in statement
to have an iterator expression of type T such that Iterator< void > is the most
specific instantiation of Iterator that is a superinterface of T, unless the iteration variable has type void. It is a compile-time error for an asynchronous
for-in statement to have a stream expression of type T such that Stream< void >
is the most specific instantiation of Stream that is a superinterface of T, unless
the iteration variable has type void.
But the code below doen't have expected errors nor in the analyzer nor in the CFE.
void main() async {
List<void> list = <void>[1, 2, 3];
for (Object? i in list) {
// ^^^^
// [analyzer] unspecified
// [cfe] unspecified
}
for (dynamic i in list) {
// ^^^^
// [analyzer] unspecified
// [cfe] unspecified
}
Stream<void> stream = Stream<void>.fromIterable([1, 2, 3]);
await for (Object? i in stream) {
// ^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
}
await for (dynamic i in stream) {
// ^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
}
}Metadata
Metadata
Assignees
Labels
cfe-dysfunctionalitiesIssues for the CFE not behaving as intendedIssues for the CFE not behaving as intendedlegacy-area-front-endLegacy: Use area-dart-model instead.Legacy: Use area-dart-model instead.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)