Currently, in the bootstrap compiler, we don't distinguish an empty function body from a non-existent one. This may lead to confusing compile errors such as:
fn main() noreturn {
_ = fn() void {}.&;
unreachable;
}
thread 15440 panic: Can't take the addr of type_idx
...
[snip]/newton/bootstrap/sema.zig:1500:48: 0x2b05e8 in semaASTExpr (bootstrap)
else => |other| std.debug.panic("Can't take the addr of {s}", .{@tagName(other)}),
^
A fix for that is obviously to distinguish between those 2 states in the parser properly, but inserting _ = undefined in the anonymous function is enough as a temporary workaround. This is a low priority issue.
Currently, in the bootstrap compiler, we don't distinguish an empty function body from a non-existent one. This may lead to confusing compile errors such as:
A fix for that is obviously to distinguish between those 2 states in the parser properly, but inserting
_ = undefinedin the anonymous function is enough as a temporary workaround. This is a low priority issue.