Added std/effecttraits.nim (#15462)

This commit is contained in:
Andreas Rumpf 2020-10-02 17:22:31 +02:00 • committed by GitHub
commit 1f4b9cebd4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 53 additions and 1 deletions

View file

@ -0,0 +1,22 @@
discard """
nimout: '''##[ValueError, Gen[string]]##'''
"""
import macros
import std / effecttraits
type
Gen[T] = object of CatchableError
x: T
macro m(call: typed): untyped =
echo "##", repr getRaisesList(call), "##"
result = call
proc r(inp: int) =
if inp == 0:
raise newException(ValueError, "bah")
elif inp == 1:
raise newException(Gen[string], "bahB")
m r(2)