From 9f8c3de46260ea4523ff7c24f8c3434f5b80eff8 Mon Sep 17 00:00:00 2001 From: David Peter Date: Wed, 4 Jun 2025 09:55:45 +0200 Subject: [PATCH] [ty] Improve docs for Class{Literal,Type}::instance_member (#18454) ## Summary Mostly just refer to `Type::instance_member` which has much more details. --- crates/ty_python_semantic/src/types/class.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/crates/ty_python_semantic/src/types/class.rs b/crates/ty_python_semantic/src/types/class.rs index ab99ae27a6..205e587fad 100644 --- a/crates/ty_python_semantic/src/types/class.rs +++ b/crates/ty_python_semantic/src/types/class.rs @@ -472,12 +472,9 @@ impl<'db> ClassType<'db> { .map_type(|ty| ty.apply_optional_specialization(db, specialization)) } - /// Returns the `name` attribute of an instance of this class. + /// Look up an instance attribute (available in `__dict__`) of the given name. /// - /// The attribute could be defined in the class body, but it could also be an implicitly - /// defined attribute that is only present in a method (typically `__init__`). - /// - /// The attribute might also be defined in a superclass of this class. + /// See [`Type::instance_member`] for more details. pub(super) fn instance_member(self, db: &'db dyn Db, name: &str) -> SymbolAndQualifiers<'db> { let (class_literal, specialization) = self.class_literal(db); class_literal @@ -1537,12 +1534,9 @@ impl<'db> ClassLiteral<'db> { attributes } - /// Returns the `name` attribute of an instance of this class. + /// Look up an instance attribute (available in `__dict__`) of the given name. /// - /// The attribute could be defined in the class body, but it could also be an implicitly - /// defined attribute that is only present in a method (typically `__init__`). - /// - /// The attribute might also be defined in a superclass of this class. + /// See [`Type::instance_member`] for more details. pub(super) fn instance_member( self, db: &'db dyn Db,