mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 21:34:57 +00:00
Fix TODO related to protocols
This commit is contained in:
parent
a285a0cdb6
commit
1476571596
2 changed files with 2 additions and 4 deletions
|
@ -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
|
from ty_extensions import is_equivalent_to, static_assert, is_assignable_to, is_subtype_of
|
||||||
|
|
||||||
class NewStyleClassScoped[T](Protocol):
|
class NewStyleClassScoped[T](Protocol):
|
||||||
def method(self: Self, input: T) -> None: ...
|
def method(self, input: T) -> None: ...
|
||||||
|
|
||||||
S = TypeVar("S")
|
S = TypeVar("S")
|
||||||
|
|
||||||
class LegacyClassScoped(Protocol[S]):
|
class LegacyClassScoped(Protocol[S]):
|
||||||
def method(self: Self, input: S) -> None: ...
|
def method(self, input: S) -> None: ...
|
||||||
|
|
||||||
# TODO: these should pass
|
# TODO: these should pass
|
||||||
static_assert(is_equivalent_to(NewStyleClassScoped, LegacyClassScoped)) # error: [static-assert-error]
|
static_assert(is_equivalent_to(NewStyleClassScoped, LegacyClassScoped)) # error: [static-assert-error]
|
||||||
|
|
|
@ -1232,8 +1232,6 @@ impl<'db> Parameters<'db> {
|
||||||
&& !is_static_or_classmethod
|
&& !is_static_or_classmethod
|
||||||
&& arg.parameter.annotation().is_none()
|
&& arg.parameter.annotation().is_none()
|
||||||
&& parameters.index(arg.name().id()) == Some(0)
|
&& 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 =
|
let method_has_self_in_generic_context =
|
||||||
method.signature(db).overloads.iter().any(|s| {
|
method.signature(db).overloads.iter().any(|s| {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue