tgetraiseslist.nim 586 B

123456789101112131415161718192021222324252627282930
  1. discard """
  2. nimout: '''##[ValueError, Gen[string]]##
  3. %%[RootEffect]%%
  4. true true'''
  5. """
  6. import macros
  7. import std / effecttraits
  8. type
  9. Gen[T] = object of CatchableError
  10. x: T
  11. macro m(call: typed): untyped =
  12. echo "##", repr getRaisesList(call[0]), "##"
  13. echo "%%", repr getTagsList(call[0]), "%%"
  14. echo isGcSafe(call[0]), " ", hasNoSideEffects(call[0])
  15. result = call
  16. proc gutenTag() {.tags: RootEffect.} = discard
  17. proc r(inp: int) =
  18. if inp == 0:
  19. raise newException(ValueError, "bah")
  20. elif inp == 1:
  21. raise newException(Gen[string], "bahB")
  22. gutenTag()
  23. m r(2)