diff options
Diffstat (limited to 'compiler/sem.nim')
-rw-r--r-- | compiler/sem.nim | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/sem.nim b/compiler/sem.nim index 214f471d6..2d69d4213 100644 --- a/compiler/sem.nim +++ b/compiler/sem.nim @@ -130,9 +130,11 @@ proc commonType*(x, y: PType): PType = elif a.kind == tyTuple and b.kind == tyTuple and a.len == b.len: var nt: PType for i in 0.. <a.len: - if isEmptyContainer(a.sons[i]) and not isEmptyContainer(b.sons[i]): + let aEmpty = isEmptyContainer(a.sons[i]) + let bEmpty = isEmptyContainer(b.sons[i]) + if aEmpty != bEmpty: if nt.isNil: nt = copyType(a, a.owner, false) - nt.sons[i] = b.sons[i] + nt.sons[i] = if aEmpty: b.sons[i] else: a.sons[i] if not nt.isNil: result = nt #elif b.sons[idx].kind == tyEmpty: return x elif a.kind == tyRange and b.kind == tyRange: |