teffects18.nim 466 B

1234567891011121314151617181920
  1. discard """
  2. action: compile
  3. errormsg: "type mismatch: got <ProcType2>"
  4. line: 19
  5. """
  6. type MyEffect = object
  7. type ProcType1 = proc (i: int): void {.forbids: [MyEffect].}
  8. type ProcType2 = proc (i: int): void
  9. proc testFunc(p: ProcType1): void = p(1)
  10. proc toBeCalled(i: int): void {.tags: [MyEffect].} = echo $i
  11. let emptyTags = proc(i: int): void {.tags: [].} = echo $i
  12. let noTags: ProcType2 = proc(i: int): void = toBeCalled(i)
  13. testFunc(emptyTags)
  14. testFunc(noTags)