-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Labels
help wantedContributions especially welcomeContributions especially welcometyMulti-file analysis & type inferenceMulti-file analysis & type inference
Milestone
Description
With #16804 completed, we have the necessary infrastructure to check subtype/assignability relationship between two callable objects. Currently, it only does the check for subtyping/assignability between two GeneralCallableType types, which effectively means typing.Callable annotation or lambdas, as those are the only things that construct the GeneralCallableType. (We do expose knot_extensions.CallableTypeFromFunction from knot_extensions which converts a FunctionType into a GeneralCallableType but that's mainly to help write tests for it.)
This issue is to check other subtype and assignability relationships involving callable objects that still need to be implemented:
- A
CallableTypeis always a subtype ofKnownClass::Object(and never the other way around) - A
FunctionTypecan be a subtype ofCallable(but never the other way around) - Other (non-
GeneralCallable)Type::Callablevariants, like bound methods, can be subtypes of / assignable toCallables. -
InstanceType (with a __call__ method)can be a subtype ofCallable(but never the other way around)
Metadata
Metadata
Assignees
Labels
help wantedContributions especially welcomeContributions especially welcometyMulti-file analysis & type inferenceMulti-file analysis & type inference