| ... | @@ -1612,6 +1612,12 @@ fn analyzeBodyInner( | ... | @@ -1612,6 +1612,12 @@ fn analyzeBodyInner( |
| 1612 | const extra = sema.code.extraData(Zir.Inst.Try, inst_data.payload_index); | 1612 | const extra = sema.code.extraData(Zir.Inst.Try, inst_data.payload_index); |
| 1613 | const inline_body = sema.code.extra[extra.end..][0..extra.data.body_len]; | 1613 | const inline_body = sema.code.extra[extra.end..][0..extra.data.body_len]; |
| 1614 | const err_union = try sema.resolveInst(extra.data.operand); | 1614 | const err_union = try sema.resolveInst(extra.data.operand); |
| | 1615 | const err_union_ty = sema.typeOf(err_union); |
| | 1616 | if (err_union_ty.zigTypeTag() != .ErrorUnion) { |
| | 1617 | return sema.fail(block, operand_src, "expected error union type, found '{}'", .{ |
| | 1618 | err_union_ty.fmt(sema.mod), |
| | 1619 | }); |
| | 1620 | } |
| 1615 | const is_non_err = try sema.analyzeIsNonErrComptimeOnly(block, operand_src, err_union); | 1621 | const is_non_err = try sema.analyzeIsNonErrComptimeOnly(block, operand_src, err_union); |
| 1616 | assert(is_non_err != .none); | 1622 | assert(is_non_err != .none); |
| 1617 | const is_non_err_tv = sema.resolveInstConst(block, operand_src, is_non_err, "try operand inside comptime block must be comptime-known") catch |err| { | 1623 | const is_non_err_tv = sema.resolveInstConst(block, operand_src, is_non_err, "try operand inside comptime block must be comptime-known") catch |err| { |
| ... | @@ -1619,7 +1625,6 @@ fn analyzeBodyInner( | ... | @@ -1619,7 +1625,6 @@ fn analyzeBodyInner( |
| 1619 | return err; | 1625 | return err; |
| 1620 | }; | 1626 | }; |
| 1621 | if (is_non_err_tv.val.toBool()) { | 1627 | if (is_non_err_tv.val.toBool()) { |
| 1622 | const err_union_ty = sema.typeOf(err_union); | | |
| 1623 | break :blk try sema.analyzeErrUnionPayload(block, src, err_union_ty, err_union, operand_src, false); | 1628 | break :blk try sema.analyzeErrUnionPayload(block, src, err_union_ty, err_union, operand_src, false); |
| 1624 | } | 1629 | } |
| 1625 | const break_data = (try sema.analyzeBodyBreak(block, inline_body)) orelse | 1630 | const break_data = (try sema.analyzeBodyBreak(block, inline_body)) orelse |