v/vlib/v/tests/match_expr_returning_sumtyp...

14 lines
200 B
V

type Ty = bool | int
fn test(a bool) Ty {
return match a {
true { 123 }
else { false }
}
}
fn test_match_expr_sumtype_eval() {
assert test(true) == Ty(123)
assert test(false) == Ty(false)
}