Repository navigation
Conversation
There was a problem hiding this comment.
Why have only some uses of expr() been replaced with reachableExpr()? It seems to me that every nearly every usage of expr() needs to check if the expr() is noreturn. I wonder if renaming expr() to exprMaybeNoReturn() and reachableExpr() to expr() would be the best way forward.
Note that the current reachableExpr() also should be updated to use GenZir.endsWithNoReturn().
|
On further investigation, I think the only place where we wouldn't be able to use the semantics of the current |
|
Though now I've remembered about #3257 and wonder if we're on the totally wrong path here... |
b0f73a6 to
1a1624e
Compare
|
Note: if we apply these checks wherever technically possible this would make the following pattern fail to compile: pub const ensureCapacity = @compileError("deprecated for ensureUnusedCapacity and ...");however, this could be worked around by wrapping the pub const ensureCapacity = {
@compileError("deprecated...");
};
// or
pub fn ensureCapacity(self: *Self, new_capacity: usize) !void {
@compileError("deprecated...");
}Applying these checks wherever possible would certainly be the most consistent approach IMO, and I don't find the workarounds too unpalatable. This feels quite arbitrary though... |
| const result_inst = try expr(gz, scope, rl, node); | ||
| if (gz.refIsNoReturn(result_inst)) { | ||
| return gz.astgen.failNodeNotes(src_node, "unreachable code", .{}, &[_]u32{ | ||
| try gz.astgen.errNoteNode(node, "control flow is diverted here", .{}), |
There was a problem hiding this comment.
what happened to this nice error note?
Also fixes #9630