blob: 73082f99784e63ed2c33abbffd24cc1c0f2e9441 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
discard """
action: compile
errormsg: "writeSomething() has an illegal effect: WriteIO"
line: 19
"""
type
IO = object of RootEffect ## input/output effect
ReadIO = object of IO ## input effect
WriteIO = object of IO ## output effect
proc readSomething(): string {.tags: [ReadIO].} = ""
proc writeSomething(): void {.tags: [WriteIO].} = echo "..."
proc noWritesPlease() {.forbids: [WriteIO].} =
# this is OK:
echo readSomething()
# the compiler prevents this:
writeSomething()
|