-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
I'm running mypy 0.950. I found a problem when I upgraded from SymPy 1.9 to SymPy 1.10.1. Both versions contain the following chained type assignments:
Matrix = MutableMatrix = MutableDenseMatrix
This caused a problem in SymPy 1.10.1 because they enabled mypy type checking in that version.
This problem can easily be recreated in a simple file, see attached.
------- begin ---------
class A:
pass
a: A = A()
B = A
b: B = B()
D = C = A
c: C = C()
d: D = D()
-------- end --------
mypy reports the following errors:
$mypy bug_mypy_chained.py
bug_mypy_chained.py:16: error: Variable "bug_mypy_chained.C" is not valid as a type
bug_mypy_chained.py:16: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
bug_mypy_chained.py:17: error: Variable "bug_mypy_chained.D" is not valid as a type
bug_mypy_chained.py:17: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
Found 2 errors in 1 file (checked 1 source file)