Replies: 1 comment
-
This question is better asked at the mypy repository. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What files should I navigate to to find the code from these screenshots? Just trying to find it so I can fix this bug. :)
python/mypy#18920 (comment)
If link doesn't work, the relevant code looks like this:
(Image 1 labeled To Reproduce)
from future import annotations
from dataclasses import dataclass
from typing import Self
type HasParent[N] = N | Node[N | HasParent[N]]
class Node[P = None]:
def parent(self) -> P: ... # type: ignore
@DataClass
class CP: Node | None = Node | None:
item: D[Self]
class DP: HasParent[C] = C:
pass
(Image 2 label starts with Changing to Self to the explicit class type (item: D[C]) is accepted.)
class CP: Node | None = Node | None:
def init(self, item: D[Self]):
self.item = item
Beta Was this translation helpful? Give feedback.
All reactions