"Fatal error: exception Assert_failure("boot/me/trans.ml", 2912, 6)" with return from for-each block
1160031
Opened by Jason Orendorff at
// Fatal error: exception Assert_failure("boot/me/trans.ml", 2912, 6)
iter x() -> int {
}
fn f() -> bool {
for each (int i in x()) {
ret true;
}
ret false;
}
fn main(vec[str] args) -> () {
}
But if you change the return type to (), different error:
// E:Assembly error: unrecognized quad 41: jmp <none>
iter x() -> int {
}
fn f() -> () {
for each (int i in x()) {
ret;
}
}
fn main(vec[str] args) -> () {
}
There's no support for breaking out of a foreach loop yet. The call protocol associated with put statements needs to understand that the inner block can return with different status indicators (returning from controlling frame, breaking loop, continuing loop) and propagate these outwards as needed. It's a bit of a task, but you're welcome to take it!
Graydon Hoare at 2010-07-12 21:55:51
Filed feature-request as #119. This one remains about an un-trapped unimpl case.
Graydon Hoare at 2010-07-22 19:24:24
Add XFAIL'ed test for return-in-iter, call unimpl when we find it. Closed by eaa35611dc2c66d73032ece1ddde7881fcaccdee.
Graydon Hoare at 2010-07-22 19:25:05