tnotnil4.nim 368 B

123456789101112131415161718192021222324
  1. discard ""
  2. type
  3. TObj = ref object
  4. {.experimental: "notnil".}
  5. proc check(a: TObj not nil) =
  6. echo repr(a)
  7. proc doit() =
  8. var x : array[0..1, TObj]
  9. let y = x[0]
  10. if y != nil:
  11. check(y)
  12. doit()
  13. # bug #2352
  14. proc p(x: proc() {.noconv.} not nil) = discard
  15. p(proc() {.noconv.} = discard)
  16. # Error: cannot prove 'proc () {.noconv.} = discard ' is not nil