Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix [override] error with no line number when argument node has no li…
…ne 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).
- Loading branch information