From 9eb3e2e2012e6024f6e4dfb909c7f6b11eb77cd7 Mon Sep 17 00:00:00 2001 From: Douglas Creager Date: Tue, 16 Dec 2025 13:02:16 -0500 Subject: [PATCH] skip inferred annotations --- crates/ty_python_semantic/src/types/class.rs | 1 + crates/ty_python_semantic/src/types/signatures.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/ty_python_semantic/src/types/class.rs b/crates/ty_python_semantic/src/types/class.rs index d5fd42ace7..a503421713 100644 --- a/crates/ty_python_semantic/src/types/class.rs +++ b/crates/ty_python_semantic/src/types/class.rs @@ -1257,6 +1257,7 @@ impl<'db> ClassType<'db> { let self_annotation = signature .parameters() .get_positional(0) + .filter(|parameter| !parameter.inferred_annotation) .and_then(Parameter::annotated_type) .filter(|ty| { ty.as_typevar() diff --git a/crates/ty_python_semantic/src/types/signatures.rs b/crates/ty_python_semantic/src/types/signatures.rs index 0a70337930..33266f8dde 100644 --- a/crates/ty_python_semantic/src/types/signatures.rs +++ b/crates/ty_python_semantic/src/types/signatures.rs @@ -2167,7 +2167,7 @@ pub(crate) struct Parameter<'db> { /// Does the type of this parameter come from an explicit annotation, or was it inferred from /// the context, like `Self` for the `self` parameter of instance methods. - inferred_annotation: bool, + pub(crate) inferred_annotation: bool, kind: ParameterKind<'db>, pub(crate) form: ParameterForm,