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
Fix [override] error with no line number when argument node has no line number (#18122)
Refs #18115
When a parameter type in a method override is incompatible with the
parameter type in the supertype definition, mypy emits an error using
the `Argument` node as the context.
However, sometimes the the `Argument` node doesn't have a line number
set, causing the error message to have no associated line number. This
happens with the `__replace__` methods created in the dataclass plugin,
which have line numbers set on the `FuncDef` nodes, but no line numbers
set on the individual argument nodes.
This PR fixes the missing line number in the error by falling-back to
the FuncDef line number when a line number isn't set on the `Argument`
node.
(As an alternative fix, we could add line numbers to the `Argument`
nodes in the dataclass plugin, but that looks like a more complicated
change since multiple methods would be affected).
0 commit comments