-
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.
Description
The code below produces no issues in the analyzer but an error in CFE.
class C<T> {
T t;
C(this.t);
}
main() {
C<void> c1 = C<void>(1);
C<void>? c2 = (2 > 1) ? C<void>(2) : null;
print(c1.t as int); // prints 1
print(c2?.t as int); // Error: This expression has type 'void' and can't be used.
}Accoding to the spec
In a type cast e as T, e may have type void
There should be no such error in the CFE.
`Dart SDK version: 3.7.0-edge.a0c4efddb8ada994c3f8568268478a4948bc32b7 (main) (Tue Nov 12 08:16:42 2024 +0000) on "linux_x64"
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.