-
Notifications
You must be signed in to change notification settings - Fork 216
Closed as duplicate of#500
Labels
bugSomething isn't workingSomething isn't workinggenericsBugs or features relating to ty's generics implementationBugs or features relating to ty's generics implementation
Description
Summary
from typing_extensions import reveal_type
from typing import Callable, TypeVar
_T = TypeVar("_T")
def f(fun: Callable[[], _T]) -> _T:
v = fun()
return v
def g() -> int:
return 42
reveal_type(g)
reveal_type(f(g))$ mypy mwe.py
mwe.py:13: note: Revealed type is "def () -> builtins.int"
mwe.py:14: note: Revealed type is "builtins.int"$ ty check mwe.py
info[revealed-type] mwe.py:13:13: Revealed type: `def g() -> int`
info[revealed-type] mwe.py:14:13: Revealed type: `Unknown`aka ty seems to not be able to infer the return type of f correctly
Version
ty 0.0.1-alpha.8 (c1337c9 2025-06-02)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggenericsBugs or features relating to ty's generics implementationBugs or features relating to ty's generics implementation