Nim/tests/notnil/tnotnil_in_objconstr.nim
2018-08-13 23:16:03 +02:00

14 lines
298 B
Nim

discard """
errormsg: "fields not initialized: bar"
line: "13"
"""
{.experimental: "notnil".}
# bug #2355
type
Foo = object
foo: ref int
bar: ref int not nil
var x: ref int = new(int)
# Create instance without initializaing the `bar` field
var f = Foo(foo: x)
echo f.bar.isNil # true