More precise error messages for uninitialized fields in the presence of inheritance
This commit is contained in:
parent
0521f98486
commit
7b7e42be54
3 changed files with 39 additions and 38 deletions
|
|
@ -1,13 +1,17 @@
|
|||
discard """
|
||||
errormsg: "The Foo type requires the following fields to be 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
|
||||
Base = object of RootObj
|
||||
baz: ref int not nil
|
||||
|
||||
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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue