Open
Description
The following program fails in both CFE and the analyzer.
main() {
int i;
if (true case == true when (i = 42) > 0) {
print("Ok");
}
i; // Error: Non-nullable variable 'i' must be assigned before it can be used.
}
Flow analysis for if-case
statements is not yet specified in the specification but intuitively I'd expect that it should detect that i
is definitely assigned here.
Dart SDK version: 3.8.0-166.0.dev (dev) (Tue Mar 4 20:02:17 2025 -0800) on "windows_x64"