-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[red-knot] remove TODO catch-all case in infer_unary_expression #14548
Comments
Hmm, I don't think that's correct when it comes to |
Yes, good point! I looked at functions and then thoughtlessly lumped classes in with them. Even for functions, we should treat them as an instance of |
) We have a handy `to_meta_type` that does the right thing for class instances, and also works for all of the other types that are “instances of” something. Unless I'm missing something, this should let us get rid of the catch-all clause in one fell swoop. cf #14548
Closed by #15045 |
Currently, the method
TypeInferenceBuilder::infer_unary_expression
handles some common cases, and has a catch-all arm that simply infers a "todo" type.This issue is to remove that todo catch-all case, and replace it with correct handling of all missing cases.
For many of the unhandled types (e.g.
Type::FunctionLiteral
,Type::ClassLiteral
,Type::SubclassOf
) the correct handling will be to treat it as aType::Instance
type (an instance oftypes.FunctionType
, or an instance of the meta-type of a class) and let the normal instance handling from typeshed take care of it.(note: edited description for correctness, which will make some comments below look out-of-context)
The text was updated successfully, but these errors were encountered: