v2 / vlib / v / checker / tests / wrong_shift_left_option_err.out
28 lines · 28 sloc · 1.3 KB · 052d862244e04dec20582eec248e5cb548060cc4
Raw
1vlib/v/checker/tests/wrong_shift_left_option_err.vv:7:2: error: cannot push to Option array that was not unwrapped first
2 5 | fn main() {
3 6 | mut a := ?[]SomeStruct([SomeStruct{}, SomeStruct{}]) // struct type
4 7 | a << []SomeStruct{len: 20}
5 | ^
6 8 | mut b := ?[]int([2, 8]) // primitive type
7 9 | b << [1, 3, 4]
8vlib/v/checker/tests/wrong_shift_left_option_err.vv:7:2: error: `?[]SomeStruct` cannot be used as `[]SomeStruct`, unwrap the option first
9 5 | fn main() {
10 6 | mut a := ?[]SomeStruct([SomeStruct{}, SomeStruct{}]) // struct type
11 7 | a << []SomeStruct{len: 20}
12 | ^
13 8 | mut b := ?[]int([2, 8]) // primitive type
14 9 | b << [1, 3, 4]
15vlib/v/checker/tests/wrong_shift_left_option_err.vv:9:2: error: cannot push to Option array that was not unwrapped first
16 7 | a << []SomeStruct{len: 20}
17 8 | mut b := ?[]int([2, 8]) // primitive type
18 9 | b << [1, 3, 4]
19 | ^
20 10 | dump(a?.len)
21 11 | dump(b)
22vlib/v/checker/tests/wrong_shift_left_option_err.vv:9:2: error: `?[]int` cannot be used as `[]int`, unwrap the option first
23 7 | a << []SomeStruct{len: 20}
24 8 | mut b := ?[]int([2, 8]) // primitive type
25 9 | b << [1, 3, 4]
26 | ^
27 10 | dump(a?.len)
28 11 | dump(b)
29