v2 / vlib / v / checker / tests / struct_field_option_err.out
34 lines · 34 sloc · 1.15 KB · 867f4376d8013aad70e524a74a58804ea12ae4e5
Raw
1vlib/v/checker/tests/struct_field_option_err.vv:3:6: error: struct field does not support storing Result
2 1 | struct Foo {
3 2 | mut:
4 3 | foo !int
5 | ^
6 4 | bar ?int = 1
7 5 | baz int = 1
8vlib/v/checker/tests/struct_field_option_err.vv:12:12: error: `+` cannot be used with `?int`
9 10 |
10 11 | _ = f.bar
11 12 | _ = f.bar + 1
12 | ^
13 13 |
14 14 | _ = f.bar!
15vlib/v/checker/tests/struct_field_option_err.vv:14:11: error: to propagate a Result, the call must also return a Result type
16 12 | _ = f.bar + 1
17 13 |
18 14 | _ = f.bar!
19 | ^
20 15 |
21 16 | _ = f.bar or { _ = 1 }
22vlib/v/checker/tests/struct_field_option_err.vv:16:19: error: last statement in the `or {}` block should be an expression of type `int` or exit parent scope
23 14 | _ = f.bar!
24 15 |
25 16 | _ = f.bar or { _ = 1 }
26 | ^
27 17 |
28 18 | _ = f.baz?
29vlib/v/checker/tests/struct_field_option_err.vv:18:11: error: unexpected `?`, the field `baz` is not an Option
30 16 | _ = f.bar or { _ = 1 }
31 17 |
32 18 | _ = f.baz?
33 | ^
34 19 | }
35