v icon indicating copy to clipboard operation
v copied to clipboard

checker: fix nested option struct with required attr init (fix #17513)

Open yuyi98 opened this issue 2 years ago • 0 comments

This PR fix nested option struct with required attr init (fix #17513).

  • Fix nested option struct with required attr init.
  • Add test.
struct AA {
	bb ?BB // defaults to none
}

struct BB {
	x string [required]
}

fn main() {
	aa := AA{}
	println(aa)
	assert aa.bb == none
}

PS D:\Test\v\tt1> v run .
AA{
    bb: Option(error: none)
}

yuyi98 avatar Mar 05 '23 14:03 yuyi98