Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support TypeExpr types #463

Open
KotlinIsland opened this issue May 10, 2023 · 1 comment
Open

Support TypeExpr types #463

KotlinIsland opened this issue May 10, 2023 · 1 comment

Comments

@KotlinIsland
Copy link
Owner

KotlinIsland commented May 10, 2023

def f(t: TypeExpr[T]) -> T: ...

reveal_type(f(int | str))  # int | str

a: TypeExpr[int | str] 
a = int | str  # valid UnionType
a = int  # valid int
a = 1  # valid, bare literal
a = object  # invalid, object isn't a subtype of int | str

I can imagine a lot of cases where there is ambiguous stuff like t: TypeExpr[Any], so we can just ban those ones.

@KotlinIsland
Copy link
Owner Author

KotlinIsland commented Jan 15, 2024

found another use case in the wild:

def cast_lambda(type: TypeExpr[Callable[P, R]], fn: Callable[P, R]) -> Callable[P, R]: ...

@KotlinIsland KotlinIsland changed the title Support TypeForm types Support TypeExpr types Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant