fixes #2216
This commit is contained in:
parent
5d9663e4de
commit
9053799bf5
5 changed files with 47 additions and 16 deletions
27
tests/notnil/tnotnil_in_generic.nim
Normal file
27
tests/notnil/tnotnil_in_generic.nim
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
discard """
|
||||
errormsg: "cannot prove 'x' is not nil"
|
||||
"""
|
||||
|
||||
# bug #2216
|
||||
|
||||
type
|
||||
A[T] = ref object
|
||||
x: int
|
||||
ud: T
|
||||
|
||||
proc good[T](p: A[T]) =
|
||||
discard
|
||||
|
||||
proc bad[T](p: A[T] not nil) =
|
||||
discard
|
||||
|
||||
|
||||
proc go() =
|
||||
let s = A[int](x: 1)
|
||||
|
||||
good(s)
|
||||
bad(s)
|
||||
var x: A[int]
|
||||
bad(x)
|
||||
|
||||
go()
|
||||
Loading…
Add table
Add a link
Reference in a new issue