-
Notifications
You must be signed in to change notification settings - Fork 227
Closed
astral-sh/ruff
#20325Labels
bugSomething isn't workingSomething isn't workinggenericsBugs or features relating to ty's generics implementationBugs or features relating to ty's generics implementation
Milestone
Description
Summary
I identified another problem that "blocks" the merge of astral-sh/ruff#18007 (in the sense that there are hundreds of false positives caused by this). It can be reproduced on main by explicitly annotating self: Self, and occurs when trying to initialize a generic class with a type parameter default value:
from typing import Self
class MyClass[T = int]:
def __init__(self: Self, x: T) -> None:
self.x = x
# error: Argument to bound method `__init__` is incorrect: Argument type `MyClass[T@MyClass]` does not satisfy upper bound of type variable `Self`
MyClass(1)https://play.ty.dev/adc72fc1-667d-4956-aa06-ed72e1403e1f
Version
Current main (25853e237)
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