v2 / vlib / v / tests / casts / as_cast_selector_test.v
18 lines · 15 sloc · 167 bytes · 6488041a749df9762348d019c4223908c476f2e2
Raw
1struct Foo {
2mut:
3 x int
4}
5
6struct Bar {
7mut:
8 y int
9}
10
11type Foobar = Bar | Foo
12
13fn test_main() {
14 mut bar := Foobar(Bar{
15 y: 123
16 })
17 assert (bar as Bar).y == 123
18}
19