Skip to content

Stack overflow on recursive TypeIs with Callable #3134

@MeGaGiGaGon

Description

@MeGaGiGaGon

Summary

This code:

from typing import TypeIs
from collections.abc import Callable
type A = TypeIs[Callable[[], A]]

Causes a stack overflow like this: thread '<unknown>' (22356) has overflowed its stack
Note that this only applies to TypeIs, TypeGaurd works fine: https://play.ty.dev/74289a8f-cbff-4219-85a8-f3b8af2e8c10

Version

ty 0.0.21 (c1ad9f2 2026-03-06)

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingfatala fatal error (panic or crash)type aliases

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions