summary refs log tree commit diff stats
path: root/tests/constructors
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2020-03-29 20:49:13 +0300
committerAndreas Rumpf <rumpf_a@web.de>2020-04-01 19:38:44 +0200
commit06438ed1431ee8ad3ae2eda9dcb7fbe64739329a (patch)
treec5f5adddb4a1af1a4cde3074032cce270dea1950 /tests/constructors
parent4f3d309fb0d17e52644029f4c593cd670516655a (diff)
downloadNim-06438ed1431ee8ad3ae2eda9dcb7fbe64739329a.tar.gz
Close https://github.com/nim-lang/Nim/issues/11428
Diffstat (limited to 'tests/constructors')
-rw-r--r--tests/constructors/tinvalid_construction.nim12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/constructors/tinvalid_construction.nim b/tests/constructors/tinvalid_construction.nim
index e6fdbcb85..c17e2123c 100644
--- a/tests/constructors/tinvalid_construction.nim
+++ b/tests/constructors/tinvalid_construction.nim
@@ -256,3 +256,15 @@ reject TNestedChoices(outerChoice: false, innerChoice: C)
 accept TNestedChoices(outerChoice: false, innerChoice: C, notnil: notNilRef)
 reject TNestedChoices(outerChoice: false, innerChoice: C, notnil: nil)
 
+block:
+  # https://github.com/nim-lang/Nim/issues/11428
+  type
+    Enum = enum A, B, C
+    Thing = object
+      case kind: Enum
+      of A: discard
+      of B: s: string
+      of C: r: range[1..1] # DateTime
+
+  # Fine to not initialize 'r' because this is implicitly initialized and known to be branch 'A'.
+  let someThing = Thing()