-
Notifications
You must be signed in to change notification settings - Fork 137
Closed
Labels
help wantedContributions especially welcomeContributions especially welcometype propertiessubtyping, assignability, equivalence, and moresubtyping, assignability, equivalence, and more
Description
Some other false positives appear to be because we lack handling of assignability/subtyping of a class literal or subclass-of type to a
Callabletype. I think the proper handling here (barring metaclass__call__handling) would consider the class to be an intersection of its__init__and__new__signatures. But we could also do a temporary version that just uses the currentType::signatures()implementation as forgiving gradual callable.Originally posted in astral-sh/ruff#16512 (comment)
This involves adding subtyping and assignability between:
-
CallableTypeandType::ClassLiteral(high priority) -
CallableTypeandType::Instance(class instance with__call__method) -
CallableTypeandType::SubclassOf -
CallableTypeandType::GenericAlias
carljm, MatthewMckee4 and Glyphack
Metadata
Metadata
Assignees
Labels
help wantedContributions especially welcomeContributions especially welcometype propertiessubtyping, assignability, equivalence, and moresubtyping, assignability, equivalence, and more