summary refs log tree commit diff stats
path: root/tests/effects/teffects18.nim
blob: 576e766358200cf75a05a54738c29c12cc443507 (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: "type mismatch: got <ProcType2>"
line: 19
"""

type MyEffect = object
type ProcType1 = proc (i: int): void {.forbids: [MyEffect].}
type ProcType2 = proc (i: int): void

proc testFunc(p: ProcType1): void = p(1)

proc toBeCalled(i: int): void {.tags: [MyEffect].} = echo $i

let emptyTags = proc(i: int): void {.tags: [].} = echo $i
let noTags: ProcType2 = proc(i: int): void = toBeCalled(i)

testFunc(emptyTags)
testFunc(noTags)