mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-03 18:28:24 +00:00
[ty] add cycle handling for FunctionType::signature query (#17833)
This fixes cycle panics in several ecosystem projects (moved to `good.txt` in a following PR https://github.com/astral-sh/ruff/pull/17834 because our mypy-primer job doesn't handle it well if we move projects to `good.txt` in the same PR that fixes `ty` to handle them), as well as in the minimal case in the added mdtest. It also fixes a number of panicking fuzzer seeds. It doesn't appear to cause any regression in any ecosystem project or any fuzzer seed.
This commit is contained in:
parent
3f32446e16
commit
4850c187ea
3 changed files with 43 additions and 6 deletions
15
crates/ty_python_semantic/resources/mdtest/cycle.md
Normal file
15
crates/ty_python_semantic/resources/mdtest/cycle.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
# Cycles
|
||||
|
||||
## Function signature
|
||||
|
||||
Deferred annotations can result in cycles in resolving a function signature:
|
||||
|
||||
```py
|
||||
from __future__ import annotations
|
||||
|
||||
# error: [invalid-type-form]
|
||||
def f(x: f):
|
||||
pass
|
||||
|
||||
reveal_type(f) # revealed: def f(x: Unknown) -> Unknown
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue