I found a potential bug (not sure) with mypy 0.740 and Python 3.6.5 & Python 3.7.1.
The following code:
# mypy: no-implicit-optional
def add(self, a: int, b: int = None) -> int:
return a + b
… gives me
run.py:4: error: Unsupported operand types for + ("int" and "None")
run.py:4: note: Right operand is of type "Optional[int]"
… but I would expect to get the more clear
run.py:3: error: Incompatible default for argument "b" (default has type "None", argument has type "int")
… because the inline config "no-implicit-optional" is set. It is the same if I have a per file/moule section in my mypy.ini, but it works i if define it globally (in [mypy] section) or via command line switch.
I found a potential bug (not sure) with mypy 0.740 and Python 3.6.5 & Python 3.7.1.
The following code:
… gives me
… but I would expect to get the more clear
… because the inline config "no-implicit-optional" is set. It is the same if I have a per file/moule section in my mypy.ini, but it works i if define it globally (in [mypy] section) or via command line switch.