summary refs log tree commit diff stats
path: root/tests/pragmas
diff options
context:
space:
mode:
authorandri lim <jangko128@gmail.com>2018-07-21 00:48:12 +0700
committerAndreas Rumpf <rumpf_a@web.de>2018-07-20 19:48:12 +0200
commit9c3336dcffcb10f662f5c358f63d073db1454116 (patch)
tree672adf24925d0eeddfd265164d9915958f023815 /tests/pragmas
parent060871e64ac9d665430d4d9ae912bf7a379ee976 (diff)
downloadNim-9c3336dcffcb10f662f5c358f63d073db1454116.tar.gz
fixes #8371, macros.hasCustomPragma doesn't crash anymore (#8378)
* fixes #8371, macros.hasCustomPragma doesn't crash anymore

* fix macros.hasCustomPragma
Diffstat (limited to 'tests/pragmas')
-rw-r--r--tests/pragmas/tcustom_pragma.nim20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/pragmas/tcustom_pragma.nim b/tests/pragmas/tcustom_pragma.nim
index a5f86b54d..d7b199a22 100644
--- a/tests/pragmas/tcustom_pragma.nim
+++ b/tests/pragmas/tcustom_pragma.nim
@@ -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