This commit is contained in:
Araq 2017-02-26 00:31:56 +01:00
commit 2589d69ed2
12 changed files with 58 additions and 42 deletions

View file

@ -191,7 +191,7 @@ proc semIf(c: PContext, n: PNode): PNode =
else:
for it in n:
let j = it.len-1
it.sons[j] = fitNode(c, typ, it.sons[j])
it.sons[j] = fitNode(c, typ, it.sons[j], it.sons[j].info)
result.kind = nkIfExpr
result.typ = typ
@ -257,7 +257,7 @@ proc semCase(c: PContext, n: PNode): PNode =
for i in 1..n.len-1:
var it = n.sons[i]
let j = it.len-1
it.sons[j] = fitNode(c, typ, it.sons[j])
it.sons[j] = fitNode(c, typ, it.sons[j], it.sons[j].info)
result.typ = typ
proc semTry(c: PContext, n: PNode): PNode =
@ -330,15 +330,15 @@ proc semTry(c: PContext, n: PNode): PNode =
result.typ = enforceVoidContext
else:
if n.lastSon.kind == nkFinally: discardCheck(c, n.lastSon.lastSon)
n.sons[0] = fitNode(c, typ, n.sons[0])
n.sons[0] = fitNode(c, typ, n.sons[0], n.sons[0].info)
for i in 1..last:
var it = n.sons[i]
let j = it.len-1
it.sons[j] = fitNode(c, typ, it.sons[j])
it.sons[j] = fitNode(c, typ, it.sons[j], it.sons[j].info)
result.typ = typ
proc fitRemoveHiddenConv(c: PContext, typ: PType, n: PNode): PNode =
result = fitNode(c, typ, n)
result = fitNode(c, typ, n, n.info)
if result.kind in {nkHiddenStdConv, nkHiddenSubConv}:
let r1 = result.sons[1]
if r1.kind in {nkCharLit..nkUInt64Lit} and typ.skipTypes(abstractRange).kind in {tyFloat..tyFloat128}:
@ -492,7 +492,7 @@ proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode =
else:
# BUGFIX: ``fitNode`` is needed here!
# check type compatibility between def.typ and typ
def = fitNode(c, typ, def)
def = fitNode(c, typ, def, def.info)
#changeType(def.skipConv, typ, check=true)
else:
typ = skipIntLit(def.typ)