[panic] infer_definition_types(Id(1412)): execute: too many cycle iterations (original) (raw)
Checking this file:
from future import annotations
import ast from typing import ( TYPE_CHECKING, Final, Literal, TypeAlias, final, )
FunctionNode: TypeAlias = ast.FunctionDef | ast.AsyncFunctionDef | ast.Lambda ComprehensionNode: TypeAlias = ( ast.ListComp | ast.SetComp | ast.DictComp | ast.GeneratorExp ) NamespaceNode: TypeAlias = ast.ClassDef | FunctionNode | ComprehensionNode
Namespace: TypeAlias = NamespaceNode | Literal["builtins", "globals"]
if TYPE_CHECKING: from collections.abc import Iterator
@final class ScopeChain: "Linked list of scopes"
__slots__ = ("depth", "ns", "parent")
def __init__(self, ns: Namespace, parent: ScopeChain | None = None) -> None:
self.ns: Final = ns
self.parent: Final = parent
self.depth: Final = 1 if parent is None else parent.depth + 1
def __iter__(self) -> Iterator[Namespace]:
n = self
while True:
yield n.ns
if n.parent is None:
break
n = n.parent
def __len__(self) -> int:
return self.depthcrashes ty:
$ uvx ty@0.0.38 check chain.py
error[panic]: Panicked at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/salsa-0.26.2/src/function/execute.rs:633:9 when checking /tmp/py/chain.py: infer_definition_types(Id(1412)): execute: too many cycle iterations
info: This indicates a bug in ty.
info: If you could open an issue at https://github.com/astral-sh/ty/issues/new?title=%5Bpanic%5D, we'd be very appreciative!
info: Platform: linux x86_64
info: Version: 0.0.38
info: Args: ["ty", "check", "chain.py"]
info: run with RUST_BACKTRACE=1 environment variable to show the full backtrace information
info: query stacktrace:
0: StaticClassLiteral < 'db >::implicit_attribute_inner_(Id(d00f))
at crates/ty_python_semantic/src/types/class/static_literal.rs:96
1: Type < 'db >::member_lookup_with_policy_(Id(302c))
at crates/ty_python_semantic/src/types.rs:881
2: infer_expression_types_impl(Id(dc02))
at crates/ty_python_semantic/src/types/infer.rs:361
3: infer_scope_types_impl(Id(1002))
at crates/ty_python_semantic/src/types/infer.rs:324
4: check_file_impl(Id(c00))
at crates/ty_project/src/lib.rs:725