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