forked from alex-eg/sex
refuse a match in a case label
case and case/fallthrough walked their label as a statement, so a match there was taken and wrote `case switch:'.
This commit is contained in:
@@ -452,6 +452,13 @@
|
||||
(reports? (sum-src "(for (var i int 0) (match s ((circle (r)) 1) (else 0)) (++ i)"
|
||||
" (= out 1.0))")
|
||||
"match is a statement"))
|
||||
(test-assert "nor as a case label"
|
||||
(reports? (sum-src "(switch 1 (case (match s ((circle (r)) 1) (else 0)) (= out 1.0)))")
|
||||
"match is a statement"))
|
||||
(test-assert "nor as a case/fallthrough's"
|
||||
(reports? (sum-src "(switch 1 (case/fallthrough (match s ((circle (r)) 1) (else 0))"
|
||||
" (= out 1.0)))")
|
||||
"match is a statement"))
|
||||
(test-assert "but an if's branches are statements, the else among them"
|
||||
(emits? (sum-src "(if (== out 0.0) (match s ((circle (r)) (= out r)) (else (= out 1.0)))"
|
||||
" (match s ((circle (r)) (= out 2.0)) (else (= out 3.0))))")
|
||||
|
||||
Reference in New Issue
Block a user