let [a] = [5, "hello"];
let {b} = {a: 5, b: "hello"};
but is currently
let [a] = [5, "hello"];
let {a: _, b} = {a: 5, b: "hello"};
To fix this, we can check if the object type's Provenance field is a pattern or not. Right now we're using env.IsPatternMatching for this purpose, but we only set IsPatternMatching inside of a pattern matching block. Patterns are used in quite a few other places so the Provenance should be more robust. We just need to remember to set that field consistently when inferring types from patterns.
The
PartialDestructuring
test case should be:but is currently
To fix this, we can check if the object type's
Provenance
field is a pattern or not. Right now we're usingenv.IsPatternMatching
for this purpose, but we only setIsPatternMatching
inside of a pattern matching block. Patterns are used in quite a few other places so theProvenance
should be more robust. We just need to remember to set that field consistently when inferring types from patterns.