-
Notifications
You must be signed in to change notification settings - Fork 227
Open
Labels
bugSomething isn't workingSomething isn't workinggenericsBugs or features relating to ty's generics implementationBugs or features relating to ty's generics implementation
Milestone
Description
Summary
In the following snippet, the return type of wrap falls back to Wrapper[Any | None]. Note that this only happens if wrap itself is generic. When the (dummy) generic context [S] is removed, the return type is Wrapper[Recursive], as expected:
type Recursive = Recursive | None
class Wrapper[T]: ...
class C[T]:
@staticmethod
def wrap[S]() -> Wrapper[T]:
return Wrapper()
reveal_type(C[Recursive].wrap()) # Wrapper[Any | None]https://play.ty.dev/14d6e89f-8f51-4322-a862-c14799c67e9a
Version
current main (25853e237)
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