aboutsummaryrefslogtreecommitdiff
path: root/v_windows/v/old/vlib/v/checker/tests/if_match_expr.vv
blob: 655f25afd2587ffb605ed6fe0bfccf1fc5cbb776 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// 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
	}
}