Summary
Here's a repo that reproduces the issue: https://github.com/jamtat/ty-hang-repro
Example code pasted here for convenience:
"""Minimal reproducer: ty >=0.0.66 never terminates on this file.
`uv run ty check` hangs indefinitely, consuming 100% CPU on one thread.
Required to reproduce the hang:
1. a self-recursive `Sequence[Rec]` union arm
2. a second arm that is a Mapping (or dict) keyed by `Any`
3. an `==` narrowing of a value of that type
4. any read of the narrowed binding afterwards
"""
from collections.abc import Mapping, Sequence
from typing import Any
type Rec = Sequence[Rec] | Mapping[Any, int]
def g(x: Rec):
assert x == 0
_ = x
Version
>=0.0.66
Summary
Here's a repo that reproduces the issue: https://github.com/jamtat/ty-hang-repro
Example code pasted here for convenience:
Version
>=0.0.66