fixes #2352
This commit is contained in:
parent
bf90b9c833
commit
cc26308044
3 changed files with 8 additions and 2 deletions
0
build.sh
Executable file → Normal file
0
build.sh
Executable file → Normal file
|
|
@ -460,7 +460,7 @@ proc notNilCheck(tracked: PEffects, n: PNode, paramType: PType) =
|
||||||
if n.kind == nkAddr:
|
if n.kind == nkAddr:
|
||||||
# addr(x[]) can't be proven, but addr(x) can:
|
# addr(x[]) can't be proven, but addr(x) can:
|
||||||
if not containsNode(n, {nkDerefExpr, nkHiddenDeref}): return
|
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:
|
# 'p' is not nil obviously:
|
||||||
return
|
return
|
||||||
case impliesNotNil(tracked.guards, n)
|
case impliesNotNil(tracked.guards, n)
|
||||||
|
|
|
||||||
|
|
@ -12,3 +12,9 @@ proc doit() =
|
||||||
check(x[0])
|
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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue