-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
area-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.For issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.model-patternsImplementation of patterns in analyzer/cfeImplementation of patterns in analyzer/cfetype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)
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.
Metadata
Metadata
Assignees
Labels
area-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.For issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.model-patternsImplementation of patterns in analyzer/cfeImplementation of patterns in analyzer/cfetype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)