What should this do?:
for x in [] { /* body */ }
Desugars to:
const it = [].iter()
loop {
switch it() {
case NONE { break }
case SOME(x) { /* body */ }
}
}
What is the type of x?
SOME case, i.e. typeof it is fn (): union{NONE}. Then the switch statement will report an unreachable case.switch to ignore the unreachable case.iter field of type array0.
while false { /* body */ }
Does not type-check body. Compiles to:
loop {
{ break }
}
if false { /* body */ }
Does not type-check body. Compiles to nothing.