Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: When we generate conditions on an index of a sequence, if the sequence is a tuple literal and the index is in-bounds, we can generate the condition on the appropriate sub-expression within the tuple literal, instead of synthesizing a new subscript expression. One gap that I discovered but didn't fix with this diff is for MatchAs, for example `match subject: case (1, 2) as z:`, which does not give the correct type to z. This is because for MatchAs we generate two refinement conditions, `z == subject && z == (1, 2)`, where `subject: tuple[object, object]`. To combine the refinements we `meet` the two types, and the result is `tuple[object, object]`, even though `tuple[1, 2]` is narrower. I think the desired behavior should be intersection, but probably not worth doing in pyre1. Reviewed By: stroxler Differential Revision: D68169119 fbshipit-source-id: 4d2867ec91414dcc8b1801739fca3d5179c1ea56
- Loading branch information