diff options
Diffstat (limited to 'compiler/semstmts.nim')
-rw-r--r-- | compiler/semstmts.nim | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index adb1c81c1..e80f1cfda 100644 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -330,7 +330,8 @@ proc semIdentDef(c: PContext, n: PNode, kind: TSymKind): PSym = styleCheckDef(result) proc checkNilable(v: PSym) = - if sfGlobal in v.flags and {tfNotNil, tfNeedsInit} * v.typ.flags != {}: + if {sfGlobal, sfImportC} * v.flags == {sfGlobal} and + {tfNotNil, tfNeedsInit} * v.typ.flags != {}: if v.ast.isNil: message(v.info, warnProveInit, v.name.s) elif tfNotNil in v.typ.flags and tfNotNil notin v.ast.typ.flags: @@ -539,7 +540,7 @@ proc symForVar(c: PContext, n: PNode): PSym = proc semForVars(c: PContext, n: PNode): PNode = result = n var length = sonsLen(n) - let iterBase = n.sons[length-2].typ.skipTypes({tyIter}) + let iterBase = n.sons[length-2].typ var iter = skipTypes(iterBase, {tyGenericInst}) # length == 3 means that there is one for loop variable # and thus no tuple unpacking: @@ -593,8 +594,7 @@ proc semFor(c: PContext, n: PNode): PNode = result.kind = nkParForStmt else: result = semForFields(c, n, call.sons[0].sym.magic) - elif (isCallExpr and call.sons[0].typ.callConv == ccClosure) or - call.typ.kind == tyIter: + elif isCallExpr and call.sons[0].typ.callConv == ccClosure: # first class iterator: result = semForVars(c, n) elif not isCallExpr or call.sons[0].kind != nkSym or |