Skip to content

Commit

Permalink
FIX: Only call match_fiddle_instance_against_bare_type if we have a f…
Browse files Browse the repository at this point in the history
…iddle instance.

PiperOrigin-RevId: 590725000
  • Loading branch information
martindemello authored and rchen152 committed Dec 14, 2023
1 parent 4509573 commit ab278ed
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pytype/matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,8 @@ def _match_instance_against_type(self, left, other_type, subst, view):
return self._match_fiddle_instance(
left.cls, left, other_type, subst, view)
elif (isinstance(other_type, abstract.PyTDClass) and
fiddle_overlay.is_fiddle_buildable_pytd(other_type.pytd_cls)):
fiddle_overlay.is_fiddle_buildable_pytd(other_type.pytd_cls) and
isinstance(left, fiddle_overlay.Buildable)):
# Handle a plain `fiddle.Config` imported from a pyi file.
return self._match_fiddle_instance_against_bare_type(
left.cls, left, other_type, subst, view)
Expand Down Expand Up @@ -1303,8 +1304,7 @@ def _match_fiddle_instance_against_bare_type(
self, left, instance, other_type, subst, view
):
"""Match a fiddle instance against an unsubscripted buildable pytd type."""
if not isinstance(instance, fiddle_overlay.Buildable):
return None
assert isinstance(instance, fiddle_overlay.Buildable)
assert isinstance(other_type, abstract.PyTDClass)
# This is a plain fiddle.Config we have imported from a pyi file and not
# subscripted, so it is still a PyTDClass
Expand Down

0 comments on commit ab278ed

Please sign in to comment.