[red-knot] Fix variable name (#17532)

This commit is contained in:
Matthew Mckee 2025-04-22 01:20:04 +01:00 committed by GitHub
parent 53ffe7143f
commit 9b5fe51b32
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 4 deletions

View File

@ -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
}