v2 / vlib / v / checker / tests / cannot_cast_to_struct.vv
18 lines · 14 sloc · 195 bytes · 0c8ce3bcb9fd4a2e5bd5f991a5a07da976d780d7
Raw
1struct Abc {}
2
3struct Xyz {}
4
5type Alphabet = Abc | Xyz
6
7struct Test {
8 abc Alphabet
9}
10
11fn main() {
12 _ := Test(Abc{})
13 sum := Alphabet(Xyz{})
14 _ = Xyz(sum)
15 _ = Xyz(5)
16 s := Abc{}
17 _ = Xyz(&s)
18}
19