-
Notifications
You must be signed in to change notification settings - Fork 216
Labels
bugSomething isn't workingSomething isn't workinggenericsBugs or features relating to ty's generics implementationBugs or features relating to ty's generics implementationtype propertiessubtyping, assignability, equivalence, and moresubtyping, assignability, equivalence, and more
Milestone
Description
With a final generic class P, we don't currently allow the class P itself to be assignable to the type type[P]:
from typing import final
@final
class P[T]:
x: T
def expects_type_p(x: type[P]):
pass
expects_type_p(P) # this call currently fails but should succeedWithout the @final, this works, because we do implement this assignability to subclass-of types. But for a final class we simplify the subclass-of type to a simple GenericAlias type, and we don't implement assignability of an unspecialized ClassLiteral to a default-specialized GenericAlias type.
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 implementationtype propertiessubtyping, assignability, equivalence, and moresubtyping, assignability, equivalence, and more