summary refs log tree commit diff stats
path: root/tests/effects/teffects14.nim
blob: 6291d95696dd14edf8a52b01dbb60f4904cfbfce (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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()