| 1 | vlib/v/checker/tests/shared_element_lock.vv:43:11: warning: arrays of references need to be initialized right away, therefore `len:` cannot be used (unless inside `unsafe`, or if you also use `init:`) |
| 2 | 41 | shared g := Pro{} |
| 3 | 42 | g.pers.age = 42 |
| 4 | 43 | mut h := []shared Pro{len: 3} |
| 5 | | ~~~~~~~~~~~~~ |
| 6 | 44 | h[2].pers.age = 42 |
| 7 | 45 | println(h[2].pers.age) |
| 8 | vlib/v/checker/tests/shared_element_lock.vv:36:5: error: `pr.pe` is `shared` and needs explicit lock for `v.ast.SelectorExpr` |
| 9 | 34 | } |
| 10 | 35 | } |
| 11 | 36 | pr.pe.color = 3 |
| 12 | | ~~ |
| 13 | 37 | shared y := pr.pe |
| 14 | 38 | rlock y { |
| 15 | vlib/v/checker/tests/shared_element_lock.vv:42:2: error: `g` is `shared` and needs explicit lock for `v.ast.SelectorExpr` |
| 16 | 40 | } |
| 17 | 41 | shared g := Pro{} |
| 18 | 42 | g.pers.age = 42 |
| 19 | | ^ |
| 20 | 43 | mut h := []shared Pro{len: 3} |
| 21 | 44 | h[2].pers.age = 42 |
| 22 | vlib/v/checker/tests/shared_element_lock.vv:44:2: error: you have to create a handle and `lock` it to modify `shared` array element |
| 23 | 42 | g.pers.age = 42 |
| 24 | 43 | mut h := []shared Pro{len: 3} |
| 25 | 44 | h[2].pers.age = 42 |
| 26 | | ~~~~ |
| 27 | 45 | println(h[2].pers.age) |
| 28 | 46 | } |
| 29 | vlib/v/checker/tests/shared_element_lock.vv:45:10: error: you have to create a handle and `rlock` it to use a `shared` element as non-mut argument to print |
| 30 | 43 | mut h := []shared Pro{len: 3} |
| 31 | 44 | h[2].pers.age = 42 |
| 32 | 45 | println(h[2].pers.age) |
| 33 | | ~~~~ |
| 34 | 46 | } |
| 35 | |