False-positive error when using Callable
in a PEP 604 type alias in a stub file with --python-version=3.9
#14158
Labels
affects-typeshed
Anything that blocks a typeshed change
bug
mypy got something wrong
false-positive
mypy gave an error on correct code
topic-pep-604
PEP 604 (union | operator)
topic-type-alias
TypeAlias and other type alias issues
Bug Report
In a stub file, with
--python-version=3.9
, mypy emits false positive errors for the following type aliases:For all of these, mypy's error message is:
Note that this snippet works fine in a
.py
or.pyi
file with--python-version 3.10
. It's only--python-version 3.9
with a.pyi
file that has the bug.To Reproduce
cd
into an up-to-date local clone of mypy with an editable install.test.pyi
file.mypy test.pyi --python-version 3.9
Expected Behavior
No error should be emitted. PEP 604 syntax should be legal in stub files, even with
--python-version 3.9
.Actual Behavior
False-positive errors are emitted.
Your Environment
--python-version 3.9
Cc. @ilevkivskyi (x-ref #12393).
The text was updated successfully, but these errors were encountered: