mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
tests: add reference_field_must_be_initialized.vv
This commit is contained in:
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| }
|
10
vlib/v/checker/tests/reference_field_must_be_initialized.vv
Normal file
10
vlib/v/checker/tests/reference_field_must_be_initialized.vv
Normal file
@ -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
Block a user