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
{{ message }}
Repository navigation
Better error location for incompatible override due to argument incompatibility #8298
An incompatible override gets reported on the first line of a method header, even though it would be better to point it at the line with an argument that is incompatible, when possible. Example:
classA:
deff(self, x: int, y: str, z: float) ->None: passclassB(A):
deff( # Argument 3 incompatible with supertype "A" <-- reported hereself,
x: int,
y: str,
z: bool, # <-- would be better to report it here
) ->None:
pass
This would improve usability, especially for methods with many arguments on many lines. This would also make it cleaner to ignore these errors, as the location of the # type: ignore comment would document which argument is incompatible (if there is one argument per line, which is a common convention).
Activity
dhalenok commentedon Jan 28, 2020
@JukkaL I'd like to help with this issue but not quite sure about where to start, any suggestions?
JukkaL commentedon Feb 4, 2020
@DenisOH Look for calls to
argument_incompatible_with_supertypeinmypy/checker.pyto find the relevant code.Arshaan-256 commentedon Feb 26, 2020
@DenisOH Can I work on this?
emmatyping commentedon Feb 26, 2020
@Arshaan-256 it looks like Denis has already made a PR for this!
Arshaan-256 commentedon Feb 26, 2020
Oh! I am so sorry. I thought that the PR didn't work since the issue was still open. Sorry!
dhalenok commentedon Feb 26, 2020
@Arshaan-256 I'm still waiting on that PR to be reviewed. However, if it's not good or needs improvement, feel free to take over the issue.
Give arguments a more reasonable location (#14562)