teffects11.nim 437 B

12345678910111213141516171819202122
  1. discard """
  2. action: compile
  3. errormsg: "type mismatch: got <proc (x: int){.gcsafe.}>"
  4. line: 21
  5. """
  6. type
  7. Effect1 = object
  8. Effect2 = object
  9. Effect3 = object
  10. proc test(fnc: proc(x: int): void {.forbids: [Effect2].}) {.tags: [Effect1, Effect3, RootEffect].} =
  11. fnc(1)
  12. proc t1(x: int): void = echo $x
  13. proc t2(x: int): void {.tags: [Effect2].} = echo $x
  14. proc t3(x: int): void {.tags: [Effect3].} = echo $x
  15. test(t1)
  16. test(t3)
  17. test(t2)