From 02db36a90af59009c635937ac5f1ba3d334d5541 Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Mon, 6 Jun 2016 10:06:39 +0200 Subject: [PATCH] fixes #3993 --- compiler/sempass2.nim | 2 +- compiler/semstmts.nim | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim index c3a9e01a0a..218ab27043 100644 --- a/compiler/sempass2.nim +++ b/compiler/sempass2.nim @@ -505,7 +505,7 @@ proc notNilCheck(tracked: PEffects, n: PNode, paramType: PType) = # addr(x[]) can't be proven, but addr(x) can: if not containsNode(n, {nkDerefExpr, nkHiddenDeref}): return elif (n.kind == nkSym and n.sym.kind in routineKinds) or - n.kind in procDefs+{nkObjConstr}: + n.kind in procDefs+{nkObjConstr, nkBracket}: # 'p' is not nil obviously: return case impliesNotNil(tracked.guards, n) diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index 0b2343c10d..7155f9c7a9 100644 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -337,7 +337,7 @@ proc checkNilable(v: PSym) = {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: + elif tfNeedsInit in v.typ.flags and tfNotNil notin v.ast.typ.flags: message(v.info, warnProveInit, v.name.s) include semasgn