Closed
Description
Bug Report
It looks like mypy doesn't support typing_extensions.Self
. I know that Rome wasn't built in a day and the work in #11871 is on the way. However, while it's still in progress, I think it would be great to have a user-friendly error message that better explains the nature of the error.
To Reproduce
from typing_extensions import Self
class A:
def f(self) -> Self:
return self
Expected Behavior
I'd expect a user-friendly error message explaining the nature of the issue, something like this:
tmp.py:5: note: "typing_extensions.Self" is not supported yet, see #11871 [misc]
Actual Behavior
tmp.py:5: error: Variable "typing_extensions.Self" is not valid as a type [valid-type]
Your Environment
- Mypy version used: 0.990
- Mypy command-line flags:
mypy tmp.py
- Mypy configuration options from
mypy.ini
(and other config files):-
- Python version used:
3.10.6