completed expr/stmt unification

This commit is contained in:
Araq 2013-05-03 23:51:43 +02:00
commit fa0a327dd6
10 changed files with 642 additions and 673 deletions

View file

@ -68,8 +68,10 @@ proc commonType*(x, y: PType): PType =
var a = skipTypes(x, {tyGenericInst})
var b = skipTypes(y, {tyGenericInst})
result = x
if a.kind in {tyExpr, tyNil}: return y
elif b.kind in {tyExpr, tyNil}: return x
if a.kind in {tyExpr, tyNil}: result = y
elif b.kind in {tyExpr, tyNil}: result = x
elif a.kind == tyStmt: result = a
elif b.kind == tyStmt: result = b
elif b.kind in {tyArray, tyArrayConstr, tySet, tySequence} and
a.kind == b.kind:
# check for seq[empty] vs. seq[int]