bugfix: type converter that converts to bool in 'if' context

This commit is contained in:
Araq 2011-03-25 00:47:03 +01:00
commit 032599c156
11 changed files with 77 additions and 25 deletions

View file

@ -792,8 +792,7 @@ proc semIfExpr(c: PContext, n: PNode): PNode =
case it.kind
of nkElifExpr:
checkSonsLen(it, 2)
it.sons[0] = semExprWithType(c, it.sons[0])
checkBool(it.sons[0])
it.sons[0] = forceBool(c, semExprWithType(c, it.sons[0]))
it.sons[1] = semExprWithType(c, it.sons[1])
if typ == nil: typ = it.sons[1].typ
else: it.sons[1] = fitNode(c, typ, it.sons[1])