summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/effects/tstrict_caseobjects.nim22
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/effects/tstrict_caseobjects.nim b/tests/effects/tstrict_caseobjects.nim
index e5e84f287..20bc810e0 100644
--- a/tests/effects/tstrict_caseobjects.nim
+++ b/tests/effects/tstrict_caseobjects.nim
@@ -1,11 +1,31 @@
 discard """
   errormsg: "field access outside of valid case branch: x.x"
-  line: 25
+  line: 45
 """
 
 {.experimental: "strictCaseObjects".}
 
 type
+  NodeKind = enum
+    nkParent,
+    nkChild
+  
+  Node {.acyclic.} = ref object
+    case kind: NodeKind
+    of nkParent:
+      children: seq[Node]
+    of nkChild:
+      name: string
+
+let list = @[Node(kind: nkParent, children: @[]), Node(kind: nkChild, name: "hello")]
+for node in list:
+  case node.kind
+  of nkChild: 
+    echo $node.name # here this time there is a warning
+  else: discard
+
+
+type
   Foo = object
     case b: bool
     of false: