From 14765715960eefe59095580b7445e501d9368d9f Mon Sep 17 00:00:00 2001 From: David Peter Date: Thu, 25 Sep 2025 13:40:31 +0200 Subject: [PATCH] Fix TODO related to protocols --- crates/ty_python_semantic/resources/mdtest/protocols.md | 4 ++-- crates/ty_python_semantic/src/types/signatures.rs | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/crates/ty_python_semantic/resources/mdtest/protocols.md b/crates/ty_python_semantic/resources/mdtest/protocols.md index 91cef8e818..6df8c1a2d3 100644 --- a/crates/ty_python_semantic/resources/mdtest/protocols.md +++ b/crates/ty_python_semantic/resources/mdtest/protocols.md @@ -1977,12 +1977,12 @@ from typing_extensions import TypeVar, Self, Protocol from ty_extensions import is_equivalent_to, static_assert, is_assignable_to, is_subtype_of class NewStyleClassScoped[T](Protocol): - def method(self: Self, input: T) -> None: ... + def method(self, input: T) -> None: ... S = TypeVar("S") class LegacyClassScoped(Protocol[S]): - def method(self: Self, input: S) -> None: ... + def method(self, input: S) -> None: ... # TODO: these should pass static_assert(is_equivalent_to(NewStyleClassScoped, LegacyClassScoped)) # error: [static-assert-error] diff --git a/crates/ty_python_semantic/src/types/signatures.rs b/crates/ty_python_semantic/src/types/signatures.rs index f8d0f92cda..55bc2e3c9c 100644 --- a/crates/ty_python_semantic/src/types/signatures.rs +++ b/crates/ty_python_semantic/src/types/signatures.rs @@ -1232,8 +1232,6 @@ impl<'db> Parameters<'db> { && !is_static_or_classmethod && arg.parameter.annotation().is_none() && parameters.index(arg.name().id()) == Some(0) - // TODO: find out why we break protocol type property tests when we include them here: - && !class.is_protocol(db) { let method_has_self_in_generic_context = method.signature(db).overloads.iter().any(|s| {