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
The annotation on the arguments for both functions are identical, and with different return types, I would expect an error to be thrown indicating that you must vary the type annotations (and to update the documentation accordingly) since this is a nonsense case.
Actual results vary based on the order of the annotation. In the order above, no error or warning is raised. If we reverse the order, we do get
test2.py:16: note: Implicit return in function which does not return
Does adjusting the behavior of overload to raise an error if you have two definitions with identical call signatures sound like the right behavior?
Environment: Python 3.6.3, mypy 0.560
The text was updated successfully, but these errors were encountered:
It appears that nonsense overloads like this just result in the return type being Any:
@overloaddeftest(input: int) ->int:
pass@overloaddeftest(input: int) ->NoReturn:
passdeftest(input):
return1reveal_type(test(1)) # Revealed type is 'Any'
There are some plans to change the way mypy handles overloads, but we've not had the time to make this a priority. If you search the tracker for overload you'll see quite a few issues.
First of all, I'd love to actually dig in and help fix this issue, just want to make sure that I choose the right path towards fixing it.
Came across some code similar to this recently:
The annotation on the arguments for both functions are identical, and with different return types, I would expect an error to be thrown indicating that you must vary the type annotations (and to update the documentation accordingly) since this is a nonsense case.
Actual results vary based on the order of the annotation. In the order above, no error or warning is raised. If we reverse the order, we do get
Does adjusting the behavior of overload to raise an error if you have two definitions with identical call signatures sound like the right behavior?
Environment: Python 3.6.3, mypy 0.560
The text was updated successfully, but these errors were encountered: