When running under the VM, the following constructs fail to promote:
var _ = switch (...) {
int? y when y != null => ... // `y` is not promoted here
...
};
if (... case int? y when y != null) {
// `y` is not promoted here
}
var _ = [if (... case int? y when y != null) ... // `y` is not promoted here
]; // And similar for sets and maps
However, trying to do the same thing with a switch statement does promote:
switch (...) {
case int? y when y != null:
// `y` is promoted to `int` here
}
This doesn't happen when running the CFE by itself (e.g. when testing in cfe-strong-linux mode). But it does happen if the program is run under the VM.
The analyzer properly promotes in all these circumstances.
I'm working on a fix.
When running under the VM, the following constructs fail to promote:
However, trying to do the same thing with a switch statement does promote:
This doesn't happen when running the CFE by itself (e.g. when testing in
cfe-strong-linuxmode). But it does happen if the program is run under the VM.The analyzer properly promotes in all these circumstances.
I'm working on a fix.