diff options
Diffstat (limited to 'compiler/sem.nim')
-rw-r--r-- | compiler/sem.nim | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/sem.nim b/compiler/sem.nim index 02c779ef0..7524d7388 100644 --- a/compiler/sem.nim +++ b/compiler/sem.nim @@ -102,8 +102,8 @@ proc commonType*(x, y: PType): PType = # if expressions, etc.: if x == nil: return x if y == nil: return y - var a = skipTypes(x, {tyGenericInst}) - var b = skipTypes(y, {tyGenericInst}) + var a = skipTypes(x, {tyGenericInst, tyAlias}) + var b = skipTypes(y, {tyGenericInst, tyAlias}) result = x if a.kind in {tyExpr, tyNil}: result = y elif b.kind in {tyExpr, tyNil}: result = x @@ -115,10 +115,10 @@ proc commonType*(x, y: PType): PType = else: result = newType(tyTypeDesc, a.owner) rawAddSon(result, newType(tyNone, a.owner)) - elif b.kind in {tyArray, tyArrayConstr, tySet, tySequence} and + elif b.kind in {tyArray, tySet, tySequence} and a.kind == b.kind: # check for seq[empty] vs. seq[int] - let idx = ord(b.kind in {tyArray, tyArrayConstr}) + let idx = ord(b.kind == tyArray) if a.sons[idx].kind == tyEmpty: return y elif a.kind == tyTuple and b.kind == tyTuple and a.len == b.len: var nt: PType |