Skip to content

Commit d70b1b1

Browse files
committed
[red-knot] Minor 'member_lookup_with_policy' fix (#17407)
## Summary Couldn't really think of a regression test, but it's probably better to fix this if we ever add new member-lookup-policies.
1 parent 182d0a1 commit d70b1b1

File tree

1 file changed

+11
-8
lines changed
  • crates/red_knot_python_semantic/src

1 file changed

+11
-8
lines changed

crates/red_knot_python_semantic/src/types.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2637,24 +2637,27 @@ impl<'db> Type<'db> {
26372637
_ => {
26382638
KnownClass::MethodType
26392639
.to_instance(db)
2640-
.member(db, &name)
2640+
.member_lookup_with_policy(db, name.clone(), policy)
26412641
.or_fall_back_to(db, || {
26422642
// If an attribute is not available on the bound method object,
26432643
// it will be looked up on the underlying function object:
2644-
Type::FunctionLiteral(bound_method.function(db)).member(db, &name)
2644+
Type::FunctionLiteral(bound_method.function(db))
2645+
.member_lookup_with_policy(db, name, policy)
26452646
})
26462647
}
26472648
},
26482649
Type::MethodWrapper(_) => KnownClass::MethodWrapperType
26492650
.to_instance(db)
2650-
.member(db, &name),
2651+
.member_lookup_with_policy(db, name, policy),
26512652
Type::WrapperDescriptor(_) => KnownClass::WrapperDescriptorType
26522653
.to_instance(db)
2653-
.member(db, &name),
2654-
Type::DataclassDecorator(_) => {
2655-
KnownClass::FunctionType.to_instance(db).member(db, &name)
2656-
}
2657-
Type::Callable(_) => KnownClass::Object.to_instance(db).member(db, &name),
2654+
.member_lookup_with_policy(db, name, policy),
2655+
Type::DataclassDecorator(_) => KnownClass::FunctionType
2656+
.to_instance(db)
2657+
.member_lookup_with_policy(db, name, policy),
2658+
Type::Callable(_) => KnownClass::Object
2659+
.to_instance(db)
2660+
.member_lookup_with_policy(db, name, policy),
26582661

26592662
Type::Instance(InstanceType { class })
26602663
if matches!(name.as_str(), "major" | "minor")

0 commit comments

Comments
 (0)