-
Notifications
You must be signed in to change notification settings - Fork 216
Closed
astral-sh/ruff
#20814Labels
bugSomething isn't workingSomething isn't workinggenericsBugs or features relating to ty's generics implementationBugs or features relating to ty's generics implementation
Description
Summary
The following code emits a diagnostic while it looks fine:
class A[T]:
def f(self: "A", a: T) -> T:
return a
class B[T](A[T]):
def f(self: "B", a: T) -> T:
# `B[Unknown]` is not an instance or subclass of `<class 'B'>` in `super(<class 'B'>, B[Unknown])` call (invalid-super-argument) [Ln 9, Col 16]
return super().f(a)playground, while pyright accepts this code.
I also tried annotating self with other types:
With specialized instance: playground
With Self type: playground
(Currently the self type example will not pass even with a non-generic too. But that will be fixed once we have implicit self.)
The problem seems to be in the Specilization::has_relation_to method because it returns false.
Version
9d8cba4 2025-06-25
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggenericsBugs or features relating to ty's generics implementationBugs or features relating to ty's generics implementation