summary refs log tree commit diff stats
path: root/tests/notnil
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2015-03-28 00:41:44 +0100
committerAraq <rumpf_a@web.de>2015-03-28 00:47:03 +0100
commit165619552a7ad0fa4f594963ee0441dd711edfd4 (patch)
treea81ec165685fdae56a01d26fe21a96e3fbd45597 /tests/notnil
parentbd56d36326da28326a494945bfafb8e40f370c8d (diff)
downloadNim-165619552a7ad0fa4f594963ee0441dd711edfd4.tar.gz
fixes #2355
Diffstat (limited to 'tests/notnil')
-rw-r--r--tests/notnil/tnotnil_in_objconstr.nim14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/notnil/tnotnil_in_objconstr.nim b/tests/notnil/tnotnil_in_objconstr.nim
new file mode 100644
index 000000000..2110bda8f
--- /dev/null
+++ b/tests/notnil/tnotnil_in_objconstr.nim
@@ -0,0 +1,14 @@
+discard """
+  errormsg: "field not initialized: bar"
+  line: "13"
+"""
+
+# bug #2355
+type
+  Foo = object
+    foo: string not nil
+    bar: string not nil
+
+# Create instance without initializaing the `bar` field
+var f = Foo(foo: "foo")
+echo f.bar.isNil # true