diff options
Diffstat (limited to 'tests/effects/teffects14.nim')
-rw-r--r-- | tests/effects/teffects14.nim | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/effects/teffects14.nim b/tests/effects/teffects14.nim new file mode 100644 index 000000000..6291d9569 --- /dev/null +++ b/tests/effects/teffects14.nim @@ -0,0 +1,15 @@ +discard """ +action: compile +errormsg: "func1() has an illegal effect: IO" +line: 15 +""" + +type IO = object ## input/output effect +proc func1(): string {.tags: [IO].} = discard +proc func2(): string = discard + +proc no_IO_please() {.forbids: [IO].} = + # this is OK because it didn't define any tag: + discard func2() + # the compiler prevents this: + let y = func1() |