You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mypy complains that "Access to generic class variables is ambiguous" when using the CRTP technique, even though the type of the class variable in question is actually known.
test.py:15: error: Access to generic class variables is ambiguous
Found 1 error in 1 file (checked 1 source file)
Expected Behavior
Mypy should not output errors, because Derived inherits the class Base[Derived] and therefore Derived has the member variable instance_list: ClassVar[list[Derived]]. Clearly the type is not generic or ambiguous at this point.
Your Environment
Mypy version used: mypy 0.910
Mypy command-line flags: none, see above
Mypy configuration options from mypy.ini (and other config files): none
Python version used: Python 3.9.6
Operating system and version: Windows 10.0.19042
The text was updated successfully, but these errors were encountered:
Bug Report
Mypy complains that "Access to generic class variables is ambiguous" when using the CRTP technique, even though the type of the class variable in question is actually known.
To Reproduce
Save the following Python program:
Actual Behavior
Executing
mypy test.py
outputs:Expected Behavior
Mypy should not output errors, because
Derived
inherits the classBase[Derived]
and thereforeDerived
has the member variableinstance_list: ClassVar[list[Derived]]
. Clearly the type is not generic or ambiguous at this point.Your Environment
mypy.ini
(and other config files): noneThe text was updated successfully, but these errors were encountered: