v2 / vlib / v / debug / tests / option.vv
28 lines · 20 sloc · 297 bytes · 135e2f1cc6dd281dba85dd34b99c22d60bd4270e
Raw
1struct Test2 {}
2
3struct Test3 {}
4
5type Test = Test2 | Test3
6
7fn (f Test) test(t ?Test) {
8 $dbg;
9}
10
11fn (f Test) test2(t ?&Test) {
12 $dbg;
13}
14
15fn test_int(a ?int) {
16 $dbg;
17}
18
19fn main() {
20 mut a := ?Test(Test2{})
21 a?.test(a)
22
23 test_int(?int(none))
24 test_int(?int(1))
25
26 b := ?&Test(none)
27 a?.test2(b)
28}
29