diff --git a/crates/red_knot_python_semantic/src/types.rs b/crates/red_knot_python_semantic/src/types.rs index c7464b8e9c..c0ccc6e7ee 100644 --- a/crates/red_knot_python_semantic/src/types.rs +++ b/crates/red_knot_python_semantic/src/types.rs @@ -1135,7 +1135,7 @@ impl<'db> Type<'db> { } (Type::ClassLiteral(_), Type::Callable(_)) => { - let metaclass_call_symbol = self + let metaclass_call_function_symbol = self .member_lookup_with_policy( db, "__call__".into(), @@ -1144,13 +1144,15 @@ impl<'db> Type<'db> { ) .symbol; - if let Symbol::Type(Type::BoundMethod(new_function), _) = metaclass_call_symbol { + if let Symbol::Type(Type::BoundMethod(metaclass_call_function), _) = + metaclass_call_function_symbol + { // TODO: this intentionally diverges from step 1 in // https://typing.python.org/en/latest/spec/constructors.html#converting-a-constructor-to-callable // by always respecting the signature of the metaclass `__call__`, rather than // using a heuristic which makes unwarranted assumptions to sometimes ignore it. - let new_function = new_function.into_callable_type(db); - return new_function.is_subtype_of(db, target); + let metaclass_call_function = metaclass_call_function.into_callable_type(db); + return metaclass_call_function.is_subtype_of(db, target); } false }