mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-06 20:04:18 +00:00
fixes #2352
This commit is contained in:
@@ -460,7 +460,7 @@ proc notNilCheck(tracked: PEffects, n: PNode, paramType: PType) =
|
||||
if n.kind == nkAddr:
|
||||
# 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:
|
||||
elif (n.kind == nkSym and n.sym.kind in routineKinds) or n.kind in procDefs:
|
||||
# 'p' is not nil obviously:
|
||||
return
|
||||
case impliesNotNil(tracked.guards, n)
|
||||
|
||||
@@ -11,4 +11,10 @@ proc doit() =
|
||||
if x[0] != nil:
|
||||
check(x[0])
|
||||
|
||||
doit()
|
||||
doit()
|
||||
|
||||
# bug #2352
|
||||
|
||||
proc p(x: proc() {.noconv.} not nil) = discard
|
||||
p(proc() {.noconv.} = discard)
|
||||
# Error: cannot prove 'proc () {.noconv.} = discard ' is not nil
|
||||
|
||||
Reference in New Issue
Block a user