better effects handling for callbacks

This commit is contained in:
Araq 2013-05-09 03:20:55 +02:00
commit 2d39a18faa
4 changed files with 63 additions and 6 deletions

View file

@ -15,3 +15,17 @@ createMenuItem(s, "Go to definition...",
echo("blah")
)
proc noRaise(x: proc()) {.raises: [].} =
# unknown call that might raise anything, but valid:
x()
proc doRaise() {.raises: [EIO].} =
raise newException(EIO, "IO")
proc use*() =
noRaise(doRaise)
# Here the compiler inferes that EIO can be raised.
use()