Closed as not planned
Description
The code below doesn't produce expected error in either CFE and the analyzer.
void test1() {
late int i;
switch (42) {
case String _: // Warning: The matched value type 'int' can never match the required type 'String'. Try using a different pattern. • pattern_never_matches_value_type
i = 42;
default:
}
i; // Definitely unassigned
//^
// [analyzer] unspecified
// [cfe] unspecified
}
Flow analysis for patterns is not specified yet, but intuitively I'd expect an error here.
Dart SDK version: 3.9.0-95.0.dev (dev) (Sun May 4 21:03:05 2025 -0700) on "windows_x64"