-
Notifications
You must be signed in to change notification settings - Fork 216
Closed
astral-sh/ruff
#21862Labels
genericsBugs or features relating to ty's generics implementationBugs or features relating to ty's generics implementation
Milestone
Description
We currently fail to select a useful specialization for the call to extract_t here:
class P[T]:
x: T
class Q[T]:
x: T
def extract_t[T](x: P[T] | Q[T]) -> T:
raise NotImplementedError
reveal_type(extract_t(P[int]())) # revealed: UnknownNote that there is some ambiguity here, because of multiple inheritance. But we should still be able to solve for T. Note that it works fine if the classes are final: https://play.ty.dev/a3821fe3-ace6-402d-b257-b74f1fd74238
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
genericsBugs or features relating to ty's generics implementationBugs or features relating to ty's generics implementation