bugfix: type converter that converts to bool in 'if' context
This commit is contained in:
parent
220dd54acf
commit
032599c156
11 changed files with 77 additions and 25 deletions
|
|
@ -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])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue