v/vlib/v/checker/tests/sum_type_mutable_cast_err.vv

22 lines
204 B
V

type Abc = int | string
struct Bar {
mut:
a Abc
}
struct Foo {
b Bar
}
fn main() {
mut x := Abc(0)
if x is int {
_ := x + 5
}
mut f := Foo{Bar{Abc(0)}}
if f.b.a is int {
_ := f.b.a + 5
}
}