[ty] Bind self with instance in __get__ (#22155)

## Summary

See: https://github.com/astral-sh/ruff/pull/22153/changes#r2641788438.
This commit is contained in:
Charlie Marsh
2025-12-23 14:25:58 -05:00
committed by GitHub
parent ed64c4d943
commit 4c175fa0e1
2 changed files with 2 additions and 3 deletions

View File

@@ -193,8 +193,7 @@ class B:
reveal_type(B().name_does_not_matter()) # revealed: B
reveal_type(B().positional_only(1)) # revealed: B
reveal_type(B().keyword_only(x=1)) # revealed: B
# TODO: This should deally be `B`
reveal_type(B().decorated_method()) # revealed: Self@decorated_method
reveal_type(B().decorated_method()) # revealed: B
reveal_type(B().a_property) # revealed: B

View File

@@ -4702,7 +4702,7 @@ impl<'db> Type<'db> {
Some((self, AttributeKind::NormalOrNonDataDescriptor))
} else {
Some((
Type::Callable(callable.bind_self(db, None)),
Type::Callable(callable.bind_self(db, Some(instance))),
AttributeKind::NormalOrNonDataDescriptor,
))
};