summary refs log blame commit diff stats
path: root/tests/notnil/tnotnil4.nim
blob: 4fd169827d94902696251b9fdd0066f63b868383 (plain) (tree)
1
2
3
4
5
6



                    

                          








                             






                                                                
discard ""
type
   TObj = ref object

{.experimental: "notnil".}

proc check(a: TObj not nil) =
  echo repr(a)

proc doit() =
   var x : array[0..1, TObj]

   if x[0] != nil:
      check(x[0])

doit()

# bug #2352

proc p(x: proc() {.noconv.} not nil) = discard
p(proc() {.noconv.} = discard)
# Error: cannot prove 'proc () {.noconv.} = discard ' is not nil