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