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 5517007 commit 675169d
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 @@ -10652,6 +10652,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 @@ -10674,6 +10675,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 675169d

Please sign in to comment.