Skip to content

Commit f174dca

Browse files
committed
Work in Progress CallableType usando pretty_callable_or_overload
1 parent e7405c9 commit f174dca

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

mypy/messages.py

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -404,22 +404,38 @@ def has_no_attr(
404404
self.unsupported_left_operand(op, original_type, context)
405405
return codes.OPERATOR
406406
elif member == "__neg__":
407+
display_type = (
408+
self.pretty_callable_or_overload(original_type)
409+
if isinstance(original_type, CallableType)
410+
else format_type(original_type, self.options)
411+
)
407412
self.fail(
408-
f"Unsupported operand type for unary - ({format_type(original_type, self.options)})",
409-
context,
410-
code=codes.OPERATOR,
411-
)
413+
f"Unsupported operand type for unary - ({display_type})",
414+
context,
415+
code=codes.OPERATOR,
416+
)
412417
return codes.OPERATOR
413418
elif member == "__pos__":
419+
420+
display_type=(
421+
self.pretty_callable_or_overload(original_type)
422+
if isinstance(original_type, CallableType)
423+
else format_type(original_type, self.options)
424+
)
414425
self.fail(
415-
f"Unsupported operand type for unary + ({format_type(original_type, self.options)})",
426+
f"Unsupported operand type for unary + ({display_type})",
416427
context,
417428
code=codes.OPERATOR,
418429
)
419430
return codes.OPERATOR
420431
elif member == "__invert__":
432+
display_type=(
433+
self.pretty_callable_or_overload(original_type)
434+
if isinstance(original_type, CallableType)
435+
else format_type(original_type, self.options)
436+
)
421437
self.fail(
422-
f"Unsupported operand type for ~ ({format_type(original_type, self.options)})",
438+
f"Unsupported operand type for ~ ({display_type})",
423439
context,
424440
code=codes.OPERATOR,
425441
)

0 commit comments

Comments
 (0)