diff --git a/vlib/v/tests/as_cast_selector_test.v b/vlib/v/tests/as_cast_selector_test.v new file mode 100644 index 0000000000..ed25d9b76a --- /dev/null +++ b/vlib/v/tests/as_cast_selector_test.v @@ -0,0 +1,18 @@ +struct Foo { +mut: + x int +} + +struct Bar { +mut: + y int +} + +type Foobar = Bar | Foo + +fn test_main() { + mut bar := Foobar(Bar{ + y: 123 + }) + assert bar as Bar.y == 123 +}