v2 / vlib / v / tests / casts / cast_interface_value_in_match_test.v
25 lines · 22 sloc · 287 bytes · 8e35f4d9848f7ad35d857a187dddbfd2eca5e19d
Raw
1interface Number2 {}
2
3fn t(v Number2) {
4 match v {
5 int, i32, isize, i64 {
6 x := isize(v)
7 println(x)
8 assert x == 42
9 }
10 else {}
11 }
12
13 match v {
14 int {
15 x := isize(v)
16 println(x)
17 assert x == 42
18 }
19 else {}
20 }
21}
22
23fn test_cast_interface_value_in_match() {
24 t(int(42))
25}
26