Summary
ty panics while type checking a function that repeatedly assigns a dynamically created type() object back to the same annotated local variable inside a loop. The issue was originally found in a test dynamically constructing nested Pydantic model classes and reproduces on ty 0.0.37 and 0.0.42.
Reproducer
Playground link.
def make_chain(depth: int) -> type[object]:
current: type[object] = type("Leaf", (object,), {})
for index in range(depth):
current = type(f"Level{index}", (object,), {"child": current})
return current
Behavior
fatal[panic] Panicked at .../salsa-0.26.2/src/function/execute.rs:633:9 when checking `repro.py`:
`infer_definition_types(Id(...)): execute: too many cycle iterations`
Found 1 diagnostic
WARN A fatal error occurred while checking some files. Not all project files were analyzed.
The non-loop variant does not cause a panic.
Version
ty 0.0.42
Summary
typanics while type checking a function that repeatedly assigns a dynamically createdtype()object back to the same annotated local variable inside a loop. The issue was originally found in a test dynamically constructing nested Pydantic model classes and reproduces onty 0.0.37and0.0.42.Reproducer
Playground link.
Behavior
The non-loop variant does not cause a panic.
Version
ty 0.0.42