From ed8a7af5e22d523e7e478153f7b61cfaffdbb458 Mon Sep 17 00:00:00 2001 From: Douglas Creager Date: Tue, 16 Dec 2025 13:06:46 -0500 Subject: [PATCH] add failing test --- .../resources/mdtest/annotations/callable.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/crates/ty_python_semantic/resources/mdtest/annotations/callable.md b/crates/ty_python_semantic/resources/mdtest/annotations/callable.md index 728566d30e..08a6d6f62a 100644 --- a/crates/ty_python_semantic/resources/mdtest/annotations/callable.md +++ b/crates/ty_python_semantic/resources/mdtest/annotations/callable.md @@ -407,4 +407,21 @@ def f_okay(c: Callable[[], None]): c.__qualname__ = "my_callable" # okay ``` +## From a class + +### Subclasses should return themselves, not superclass + +```py +from ty_extensions import into_callable + +class Base: + def __init__(self) -> None: pass + +class A(Base): + pass + +# revealed: () -> A +reveal_type(into_callable(A)) +``` + [gradual form]: https://typing.python.org/en/latest/spec/glossary.html#term-gradual-form