From dad1c54e4c962e62bf52cd92fd56834cbb3511ad Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Mon, 22 Dec 2025 22:36:44 -0500 Subject: [PATCH] [ty] Bind self with instance in __get__ --- 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 b3563e8935a51..767e2e1f173b2 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 da46f40709068..78c0ebe0bfbb6 100644 --- a/crates/ty_python_semantic/src/types.rs +++ b/crates/ty_python_semantic/src/types.rs @@ -4699,7 +4699,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, )) };