Open spacether opened 1 year ago
It looks like this is happening because the property method for decimal is defined before the new method in the class's namespace. Because of this, __new__
sees decimal
as the adjacent method in the class and not the imported module
So if one moves the new method before the property method, this problem goes away.
Bug Report
Input argument in new method incorrectly reports that its type is undefined I import the decimal module, I have an input in
__new__
named decimal of type decimal.Decimal Python code runs but mypy reports:To Reproduce
Expected Behavior
I expect mypy to understand that decimal was imported earlier and I can use decimal.Decimal as my type hint.
Actual Behavior
Mypy gets confused and reports:
Your Environment
mypy.ini
(and other config files): n/a