Skip to content

Commit acbed24

Browse files
committed
render unions with new union syntax in output messages
1 parent 91f675f commit acbed24

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Basedmypy Changelog
22

33
## [Unreleased]
4+
### Added
5+
- Unions in output messages show with new syntax
46

57
## [1.0.0]
68
### Added

mypy/types.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1873,6 +1873,9 @@ def __init__(self, items: Sequence[Type], line: int = -1, column: int = -1,
18731873
def __hash__(self) -> int:
18741874
return hash(frozenset(self.items))
18751875

1876+
def __repr__(self):
1877+
return " | ".join(map(repr, self.items))
1878+
18761879
def __eq__(self, other: object) -> bool:
18771880
if not isinstance(other, UnionType):
18781881
return NotImplemented

0 commit comments

Comments
 (0)