summary refs log tree commit diff stats
path: root/tests/notnil/tnotnil_in_objconstr.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/notnil/tnotnil_in_objconstr.nim')
-rw-r--r--tests/notnil/tnotnil_in_objconstr.nim18
1 files changed, 11 insertions, 7 deletions
diff --git a/tests/notnil/tnotnil_in_objconstr.nim b/tests/notnil/tnotnil_in_objconstr.nim
index d33709906..471150f44 100644
--- a/tests/notnil/tnotnil_in_objconstr.nim
+++ b/tests/notnil/tnotnil_in_objconstr.nim
@@ -1,14 +1,18 @@
 discard """
-  errormsg: "fields not initialized: bar"
-  line: "13"
+  errormsg: "The Foo type requires the following fields to be initialized: bar, baz"
+  line: "17"
 """
 {.experimental: "notnil".}
 # bug #2355
 type
-  Foo = object
-    foo: string not nil
-    bar: string not nil
+  Base = object of RootObj
+    baz: ref int not nil
 
-# Create instance without initializaing the `bar` field
-var f = Foo(foo: "foo")
+  Foo = object of Base
+    foo: ref int
+    bar: ref int not nil
+
+var x: ref int = new(int)
+# Create instance without initializing the `bar` field
+var f = Foo(foo: x)
 echo f.bar.isNil # true