diff --git a/TODOLIST b/TODOLIST index f349725..22c296b 100644 --- a/TODOLIST +++ b/TODOLIST @@ -1,5 +1,3 @@ -returns inside loops (else conditional) -returns inside loops (non-conditional) function pointers for loops arrays diff --git a/bootstrap/compiler.zig b/bootstrap/compiler.zig index 08b0897..96e49cf 100644 --- a/bootstrap/compiler.zig +++ b/bootstrap/compiler.zig @@ -3991,8 +3991,6 @@ pub fn analyze_local_block(thread: *Thread, analyzer: *Analyzer, parser: *Parser const loop_block = analyze_local_block(thread, analyzer, parser, file); if (!loop_block.terminated) { _ = emit_jump(analyzer, thread, loop_header_block); - } else { - unreachable; } }, else => unreachable, diff --git a/retest/standalone/loop_return_no_conditional/main.nat b/retest/standalone/loop_return_no_conditional/main.nat new file mode 100644 index 0000000..4e6b118 --- /dev/null +++ b/retest/standalone/loop_return_no_conditional/main.nat @@ -0,0 +1,7 @@ +fn[cc(.c)] main[export]() s32 { + >i: s32 = 0; + loop (i < 1) { + return 0; + } + return 1; +}