tstrict_effects.nim 581 B

12345678910111213141516171819202122232425262728
  1. discard """
  2. errormsg: "s1 can raise an unlisted exception: CatchableError"
  3. line: 27
  4. """
  5. {.push warningAsError[Effect]: on.}
  6. {.experimental: "strictEffects".}
  7. # bug #18376
  8. {.push raises: [Defect].}
  9. type Call = proc (x: int): int {.gcsafe, raises: [Defect, CatchableError].}
  10. type Bar* = object
  11. foo*: Call
  12. proc passOn*(x: Call) = discard
  13. proc barCal(b: var Bar, s: string, s1: Call) =
  14. #compiler complains that his line can throw CatchableError
  15. passOn s1
  16. proc passOnB*(x: Call) {.effectsOf: x.} = discard
  17. proc barCal2(b: var Bar, s: string, s1: Call) =
  18. passOnB s1