summary refs log blame commit diff stats
path: root/tests/notnil/tnotnil_in_objconstr.nim
blob: f0d5c1ae20e10581d80a28d2c0fe97287fe18b0d (plain) (tree)
1
2
3
4
5
6
7
8
           
                                         

            
                          


              


                         
                                                       
                   
                       
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