tests: add reference_field_must_be_initialized.vv
parent
bf8ed1815c
commit
1e910c6afe
|
@ -0,0 +1,7 @@
|
||||||
|
vlib/v/checker/tests/reference_field_must_be_initialized.v:8:7: error: reference field `Node.next` must be initialized
|
||||||
|
6|
|
||||||
|
7| fn main(){
|
||||||
|
8| n := Node{ data: 123 }
|
||||||
|
~~~~~~~~~~~~~~~~~
|
||||||
|
9| eprintln('n.data: $n.data')
|
||||||
|
10| }
|
|
@ -0,0 +1,10 @@
|
||||||
|
module main
|
||||||
|
struct Node {
|
||||||
|
data int
|
||||||
|
next &Node = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main(){
|
||||||
|
n := Node{ data: 123 }
|
||||||
|
eprintln('n.data: $n.data')
|
||||||
|
}
|
Loading…
Reference in New Issue