Open
Description
Example:
void main() {
var s = ("a", "b", "c") as (Object?, void, Object?);
switch (s) {
case var x when x.l("1.x") || s.l("1.s"): // void
case var x when x.l("2.x") || s.l("2.s"): // void
case (_, _, _) && var x when x.l("3.x") || s.l("3.s"): // Object?
case var x when x.l("4.x") || s.l("4.s"): // Object?
}
}
extension <T> on T {
bool l(String name) {
print("$name: $this:$runtimeType @ $T"); // value, runtime and static type
return false;
}
}
The case (_, _, _)
, which should be a no-op for a matched value type of (Object?, void, Object?)
"promotes" the middle record field's static type to Object?
.
That loses void
protection.
If it's not an implementation bug, then it's a spec bug, but it should still be fixed.