Skip to content

Commit

Permalink
Update pattern-matching for error unwrapping
Browse files Browse the repository at this point in the history
The new .save_err_ret_index that can be at the front of a block can
surprise the `catch unreachable` pattern matcher.
  • Loading branch information
topolarity committed Sep 26, 2022
1 parent 08efb24 commit 1511488
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Sema.zig
Original file line number Diff line number Diff line change
Expand Up @@ -10668,6 +10668,7 @@ fn maybeErrorUnwrap(sema: *Sema, block: *Block, body: []const Zir.Inst.Index, op
const tags = sema.code.instructions.items(.tag);
for (body) |inst| {
switch (tags[inst]) {
.save_err_ret_index,
.dbg_block_begin,
.dbg_block_end,
.dbg_stmt,
Expand All @@ -10690,6 +10691,10 @@ fn maybeErrorUnwrap(sema: *Sema, block: *Block, body: []const Zir.Inst.Index, op
try sema.zirDbgStmt(block, inst);
continue;
},
.save_err_ret_index => {
try sema.zirSaveErrRetIndex(block, inst);
continue;
},
.str => try sema.zirStr(block, inst),
.as_node => try sema.zirAsNode(block, inst),
.field_val => try sema.zirFieldVal(block, inst),
Expand Down

0 comments on commit 1511488

Please sign in to comment.