mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-03 11:42:33 +00:00
30 lines
498 B
Nim
30 lines
498 B
Nim
discard """
|
|
action: compile
|
|
"""
|
|
|
|
{.push warningAsError[Effect]: on.}
|
|
|
|
{.experimental: "strictEffects".}
|
|
|
|
proc fn(a: int, p1, p2: proc()) {.effectsOf: p1.} =
|
|
if a == 7:
|
|
p1()
|
|
if a<0:
|
|
raise newException(ValueError, $a)
|
|
|
|
proc main() {.raises: [ValueError].} =
|
|
fn(1, proc()=discard, proc() = raise newException(IOError, "foo"))
|
|
main()
|
|
|
|
# bug #19159
|
|
|
|
import macros
|
|
|
|
func mkEnter() =
|
|
template helper =
|
|
discard
|
|
when defined pass:
|
|
helper()
|
|
else:
|
|
let ast = getAst(helper())
|