Nim/tests/notnil/tnotnil_in_generic.nim
2015-02-26 02:05:23 +01:00

27 lines
310 B
Nim

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()