-
Notifications
You must be signed in to change notification settings - Fork 216
Closed
astral-sh/ruff
#23108Labels
typing semanticstyping-module features, spec compliance, etctyping-module features, spec compliance, etc
Milestone
Description
Summary
The following code:
from dataclasses import dataclass
from typing import Optional, Self
@dataclass(frozen=True)
class MyClass:
field: Optional[Self] = None
MyClass(MyClass())reports the following, which I believe should not be an error:
error[invalid-argument-type]: Argument is incorrect
--> src\main.py:10:9
|
10 | MyClass(MyClass())
| ^^^^^^^^^ Expected `typing.Self | None`, found `MyClass`
|
info: rule `invalid-argument-type` is enabled by default
Found 1 diagnostic
Version
0.0.1-alpha.20 (f41f00a 2025-09-03)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
typing semanticstyping-module features, spec compliance, etctyping-module features, spec compliance, etc