ruff
68851547 - [ty] Recover cycles when constructing known class instances (#28289)

Commit
4 days ago
[ty] Recover cycles when constructing known class instances (#28289) String member lookup can panic when a first-party `typing.py` introduces an inference cycle through class and metaclass resolution. Add cycle recovery to `known_class_to_instance` so inference can converge and checking reports the ordinary diagnostics. Fixes astral-sh/ty#4456. ## Test plan Add mdtests with a local `typing.py` whose function call requires resolving an unknown metaclass before a `Sequence` binding. Check the consumer both before and after the shadowing module. Both scenarios verify that `str.encode()` retains its `bytes` return type and that the unresolved metaclass produces the expected diagnostic.
Author
Parents
Loading