fixes #8371, macros.hasCustomPragma doesn't crash anymore (#8378)

* fixes #8371, macros.hasCustomPragma doesn't crash anymore

* fix macros.hasCustomPragma
This commit is contained in:
andri lim 2018-07-21 00:48:12 +07:00 • committed by Andreas Rumpf
commit 9c3336dcff
2 changed files with 23 additions and 1 deletions

View file

@ -154,3 +154,23 @@ block:
let a: proc(x: int) {.defaultValue(5).} = nil
static:
doAssert hasCustomPragma(a.type, defaultValue)
# bug #8371
template thingy {.pragma.}
type
Cardinal = enum
north, east, south, west
Something = object
a: float32
case cardinal: Cardinal
of north:
b {.thingy.}: int
of east:
c: int
of south: discard
else: discard
var foo: Something
foo.cardinal = north
doAssert foo.b.hasCustomPragma(thingy) == true