-
Notifications
You must be signed in to change notification settings - Fork 135
Closed
Labels
bugSomething isn't workingSomething isn't workinghelp wantedContributions especially welcomeContributions especially welcometype propertiessubtyping, assignability, equivalence, and moresubtyping, assignability, equivalence, and more
Description
All four reveal-types at the end of this example should reveal Literal[True]:
from typing import Callable, reveal_type
from ty_extensions import Intersection, Unknown, CallableTypeOf, Not, is_assignable_to
def f(*n1, **n2) -> None: ...
type A = Not[Callable[..., None]]
type B = Not[CallableTypeOf[f]]
def g(a: A, b: B):
reveal_type(a)
reveal_type(b)
reveal_type(is_assignable_to(A, A | B)) # revealed: Literal[True]
reveal_type(is_assignable_to(A, B | A)) # revealed: Literal[False]
reveal_type(is_assignable_to(B, A | B)) # revealed: Literal[False]
reveal_type(is_assignable_to(B, B | A)) # revealed: Literal[True]Originally revealed by property tests in this run: https://github.com/astral-sh/ty/actions/runs/16550887703
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghelp wantedContributions especially welcomeContributions especially welcometype propertiessubtyping, assignability, equivalence, and moresubtyping, assignability, equivalence, and more