diff options
author | Araq <rumpf_a@web.de> | 2013-05-03 23:51:43 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2013-05-03 23:51:43 +0200 |
commit | fa0a327dd6f8f18ce935f6bd8993e4af474d1231 (patch) | |
tree | 444367f8069a14968bbc4c9e1d6986c281c6862b /compiler/sem.nim | |
parent | 8e5d6834cc51062a9d249fd7730432d32b7f6adc (diff) | |
download | Nim-fa0a327dd6f8f18ce935f6bd8993e4af474d1231.tar.gz |
completed expr/stmt unification
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 791ca2793..cd332ad90 100644 --- a/compiler/sem.nim +++ b/compiler/sem.nim @@ -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] |