Skip to content

Commit

Permalink
Do not attempt to track matches if the match variable contains an Any
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 605115451
  • Loading branch information
martindemello authored and rchen152 committed Feb 8, 2024
1 parent dd6df8d commit b2351e1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pytype/pattern_matching.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@ def __init__(self, match_var, ctx):
self.is_valid: bool = True

for d in match_var.data:
if isinstance(d, abstract.Instance):
if isinstance(d, abstract.Unsolvable):
self.is_valid = False
self.could_contain_anything = True
elif isinstance(d, abstract.Instance):
self.options.add_instance(d)
else:
self.options.add_type(d)
Expand Down

0 comments on commit b2351e1

Please sign in to comment.