tnotnil4.nim 358 B

1234567891011121314151617181920212223
  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. if x[0] != nil:
  10. check(x[0])
  11. doit()
  12. # bug #2352
  13. proc p(x: proc() {.noconv.} not nil) = discard
  14. p(proc() {.noconv.} = discard)
  15. # Error: cannot prove 'proc () {.noconv.} = discard ' is not nil