tstrict_effects3.nim 346 B

123456789101112131415161718
  1. discard """
  2. action: compile
  3. """
  4. {.push warningAsError[Effect]: on.}
  5. {.experimental: "strictEffects".}
  6. proc fn(a: int, p1, p2: proc()) {.effectsOf: p1.} =
  7. if a == 7:
  8. p1()
  9. if a<0:
  10. raise newException(ValueError, $a)
  11. proc main() {.raises: [ValueError].} =
  12. fn(1, proc()=discard, proc() = raise newException(IOError, "foo"))
  13. main()