Skip to content

Commit 4d108e2

Browse files
committed
fix: pretty_callable's handling of TypeGuards
1 parent 5d94074 commit 4d108e2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

mypy/messages.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1948,7 +1948,12 @@ def [T <: int] f(self, x: int, y: T) -> None
19481948
else:
19491949
s = '({})'.format(s)
19501950

1951-
s += ' -> ' + format_type_bare(tp.ret_type)
1951+
s += ' -> '
1952+
if tp.type_guard is not None:
1953+
s += 'TypeGuard[{}]'.format(format_type_bare(tp.type_guard))
1954+
else:
1955+
s += format_type_bare(tp.ret_type)
1956+
19521957
if tp.variables:
19531958
tvars = []
19541959
for tvar in tp.variables:

0 commit comments

Comments
 (0)