v4 / vlib / v / checker / tests / lock_needed.vv
31 lines · 27 sloc · 266 bytes · dbbf96702b782b02b8779d1c27601ea049f3a7f5
Raw
1struct St {
2mut:
3 x int
4}
5
6fn main() {
7 shared abc := &St{
8 x: 5
9 }
10 abc.x++
11 println(abc.x)
12}
13
14struct Abc {
15mut:
16 st shared St
17}
18
19fn f() {
20 mut a := Abc{
21 st: St{
22 x: 9
23 }
24 }
25 println(a.st.x)
26}
27
28fn g() {
29 shared a := []f64{len: 10, init: 7.5}
30 println(a[3])
31}
32