v/vlib/v/checker/tests/if_match_expr.vv

28 lines
666 B
V

// only C expressions are allowed for each statement
_ = if true {
if true {} // FIXME should error, if statement
_ = if true {1} else {-1} // OK
if true {1} else {-1} // result
} else {
for {break}
{}
match true {true {} else {}} // statement not expression
_ = match true {true {1} else {-1}} // OK
match true {true {1} else {-1}} // result
}
_ = match true {
true {
if true {} // statement not expression
_ = if true {1} else {-1} // OK
if true {1} else {-1} // result
}
else {
assert true
match true {true {} else {}} // statement not expression
_ = match true {true {1} else {-1}} // OK
match true {true {1} else {-1}} // result
}
}