diff options
Diffstat (limited to 'tests/effects/teffects15.nim')
-rw-r--r-- | tests/effects/teffects15.nim | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/effects/teffects15.nim b/tests/effects/teffects15.nim new file mode 100644 index 000000000..c3079cdbc --- /dev/null +++ b/tests/effects/teffects15.nim @@ -0,0 +1,18 @@ +discard """ +action: compile +errormsg: "method1(c) has an illegal effect: IO" +line: 18 +""" + +type + IO = object ## input/output effect + CustomObject* = object of RootObj + text: string + +method method1(obj: var CustomObject): string {.tags: [IO].} = obj.text & "." +method method2(obj: var CustomObject): string = obj.text & ":" + +proc noIO() {.forbids: [IO].} = + var c = CustomObject(text: "a") + echo c.method2() + echo c.method1() |