summary refs log tree commit diff stats
path: root/tests/pragmas
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2022-10-03 16:37:27 +0800
committerGitHub <noreply@github.com>2022-10-03 10:37:27 +0200
commit852a7c4919d7801bc73310fecca14faaeb278652 (patch)
treec5de9ef7d5b5fe896bfdb68fa72d6da51ebd8e05 /tests/pragmas
parent2cca38d33c50650d1606c6ec09c73af6b8b0c3c8 (diff)
downloadNim-852a7c4919d7801bc73310fecca14faaeb278652.tar.gz
close #11415; add testcase (#20486)
Diffstat (limited to 'tests/pragmas')
-rw-r--r--tests/pragmas/tcustom_pragma.nim25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/pragmas/tcustom_pragma.nim b/tests/pragmas/tcustom_pragma.nim
index 5a68b7677..ad25cad98 100644
--- a/tests/pragmas/tcustom_pragma.nim
+++ b/tests/pragmas/tcustom_pragma.nim
@@ -423,6 +423,31 @@ when false:
 
   doAssert hasMyAttr(TObj)
 
+
+# bug #11415
+template noserialize() {.pragma.}
+
+type
+  Point[T] = object
+    x, y: T
+
+  ReplayEventKind = enum
+    FoodAppeared, FoodEaten, DirectionChanged
+
+  ReplayEvent = object
+    case kind: ReplayEventKind
+    of FoodEaten, FoodAppeared: # foodPos is in multiple branches
+      foodPos {.noserialize.}: Point[float]
+    of DirectionChanged:
+      playerPos: float
+let ev = ReplayEvent(
+    kind: FoodEaten,
+    foodPos: Point[float](x: 5.0, y: 1.0)
+  )
+
+doAssert ev.foodPos.hasCustomPragma(noserialize)
+
+
 when false:
   # misc
   {.pragma: haha.}