summary refs log blame commit diff stats
path: root/tests/notnil/tnotnil_in_generic.nim
blob: 89d20f1826baa90dbdb3e83a49555720ff59b96f (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12




                                         
                          





                     
                       

           
                              


           
           







                        
discard """
  errormsg: "cannot prove 'x' is not nil"
"""

# bug #2216
{.experimental: "notnil".}

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