From 4c175fa0e1d2d3359eedcd9ee9c1a35fc1e9848b Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Tue, 23 Dec 2025 14:25:58 -0500 Subject: [PATCH] [ty] Bind self with instance in `__get__` (#22155) ## Summary See: https://github.com/astral-sh/ruff/pull/22153/changes#r2641788438. --- crates/ty_python_semantic/resources/mdtest/annotations/self.md | 3 +-- crates/ty_python_semantic/src/types.rs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/crates/ty_python_semantic/resources/mdtest/annotations/self.md b/crates/ty_python_semantic/resources/mdtest/annotations/self.md index b3563e8935..767e2e1f17 100644 --- a/crates/ty_python_semantic/resources/mdtest/annotations/self.md +++ b/crates/ty_python_semantic/resources/mdtest/annotations/self.md @@ -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 diff --git a/crates/ty_python_semantic/src/types.rs b/crates/ty_python_semantic/src/types.rs index cc05c9c000..77c594d794 100644 --- a/crates/ty_python_semantic/src/types.rs +++ b/crates/ty_python_semantic/src/types.rs @@ -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, )) };