Skip to content

Commit 617903a

Browse files
authored
Show column number for reveal_type() expressions (#2397)
1 parent 96913d8 commit 617903a

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

mypy/semanal.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2241,6 +2241,7 @@ def visit_call_expr(self, expr: CallExpr) -> None:
22412241
return
22422242
expr.analyzed = RevealTypeExpr(expr.args[0])
22432243
expr.analyzed.line = expr.line
2244+
expr.analyzed.column = expr.column
22442245
expr.analyzed.accept(self)
22452246
elif refers_to_fullname(expr.callee, 'typing.Any'):
22462247
# Special form Any(...).

test-data/unit/check-generics.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,8 +621,8 @@ main:16:18: error: "list" expects 1 type argument, but 2 given
621621
main:17:24: error: "Node" expects 2 type arguments, but 1 given
622622
main:18:3: error: "Node" expects 2 type arguments, but 1 given
623623
main:19:4: error: Bad number of arguments for type alias, expected: 1, given: 2
624-
main:22: error: Revealed type is '__main__.Node[builtins.int, builtins.str]'
625-
main:24: error: Revealed type is '__main__.Node[__main__.Node[builtins.int, builtins.int], builtins.list[builtins.int]]'
624+
main:22:0: error: Revealed type is '__main__.Node[builtins.int, builtins.str]'
625+
main:24:0: error: Revealed type is '__main__.Node[__main__.Node[builtins.int, builtins.int], builtins.list[builtins.int]]'
626626
main:26:4: error: Type variable "__main__.T" is invalid as target for type alias
627627

628628
[case testGenericTypeAliasesForAliases]

0 commit comments

Comments
 (0)