summary refs log tree commit diff stats
path: root/tests/notnil/tnotnil_in_objconstr.nim
blob: 7dce98c29ffb09ac50e3d00413a983d7150aef78 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
discard """
  errormsg: "fields 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