| ... | @@ -19182,7 +19182,7 @@ fn zirRetErrValue( | ... | @@ -19182,7 +19182,7 @@ fn zirRetErrValue( |
| 19182 | .ty = error_set_type.toIntern(), | 19182 | .ty = error_set_type.toIntern(), |
| 19183 | .name = err_name, | 19183 | .name = err_name, |
| 19184 | } }))); | 19184 | } }))); |
| 19185 | return sema.analyzeRet(block, result_inst, src); | 19185 | return sema.analyzeRet(block, result_inst, src, src); |
| 19186 | } | 19186 | } |
| 19187 | | 19187 | |
| 19188 | fn zirRetImplicit( | 19188 | fn zirRetImplicit( |
| ... | @@ -19232,7 +19232,7 @@ fn zirRetImplicit( | ... | @@ -19232,7 +19232,7 @@ fn zirRetImplicit( |
| 19232 | return sema.failWithOwnedErrorMsg(block, msg); | 19232 | return sema.failWithOwnedErrorMsg(block, msg); |
| 19233 | } | 19233 | } |
| 19234 | | 19234 | |
| 19235 | return sema.analyzeRet(block, operand, r_brace_src); | 19235 | return sema.analyzeRet(block, operand, r_brace_src, r_brace_src); |
| 19236 | } | 19236 | } |
| 19237 | | 19237 | |
| 19238 | fn zirRetNode(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Zir.Inst.Index { | 19238 | fn zirRetNode(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Zir.Inst.Index { |
| ... | @@ -19243,7 +19243,7 @@ fn zirRetNode(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Zir | ... | @@ -19243,7 +19243,7 @@ fn zirRetNode(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Zir |
| 19243 | const operand = try sema.resolveInst(inst_data.operand); | 19243 | const operand = try sema.resolveInst(inst_data.operand); |
| 19244 | const src = inst_data.src(); | 19244 | const src = inst_data.src(); |
| 19245 | | 19245 | |
| 19246 | return sema.analyzeRet(block, operand, src); | 19246 | return sema.analyzeRet(block, operand, src, .{ .node_offset_return_operand = inst_data.src_node }); |
| 19247 | } | 19247 | } |
| 19248 | | 19248 | |
| 19249 | fn zirRetLoad(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Zir.Inst.Index { | 19249 | fn zirRetLoad(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Zir.Inst.Index { |
| ... | @@ -19256,7 +19256,7 @@ fn zirRetLoad(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Zir | ... | @@ -19256,7 +19256,7 @@ fn zirRetLoad(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Zir |
| 19256 | | 19256 | |
| 19257 | if (block.is_comptime or block.inlining != null or sema.func_is_naked) { | 19257 | if (block.is_comptime or block.inlining != null or sema.func_is_naked) { |
| 19258 | const operand = try sema.analyzeLoad(block, src, ret_ptr, src); | 19258 | const operand = try sema.analyzeLoad(block, src, ret_ptr, src); |
| 19259 | return sema.analyzeRet(block, operand, src); | 19259 | return sema.analyzeRet(block, operand, src, .{ .node_offset_return_operand = inst_data.src_node }); |
| 19260 | } | 19260 | } |
| 19261 | | 19261 | |
| 19262 | if (sema.wantErrorReturnTracing(sema.fn_ret_ty)) { | 19262 | if (sema.wantErrorReturnTracing(sema.fn_ret_ty)) { |
| ... | @@ -19450,6 +19450,7 @@ fn analyzeRet( | ... | @@ -19450,6 +19450,7 @@ fn analyzeRet( |
| 19450 | block: *Block, | 19450 | block: *Block, |
| 19451 | uncasted_operand: Air.Inst.Ref, | 19451 | uncasted_operand: Air.Inst.Ref, |
| 19452 | src: LazySrcLoc, | 19452 | src: LazySrcLoc, |
| | 19453 | operand_src: LazySrcLoc, |
| 19453 | ) CompileError!Zir.Inst.Index { | 19454 | ) CompileError!Zir.Inst.Index { |
| 19454 | // Special case for returning an error to an inferred error set; we need to | 19455 | // Special case for returning an error to an inferred error set; we need to |
| 19455 | // add the error tag to the inferred error set of the in-scope function, so | 19456 | // add the error tag to the inferred error set of the in-scope function, so |
| ... | @@ -19458,14 +19459,14 @@ fn analyzeRet( | ... | @@ -19458,14 +19459,14 @@ fn analyzeRet( |
| 19458 | if (sema.fn_ret_ty_ies != null and sema.fn_ret_ty.zigTypeTag(mod) == .ErrorUnion) { | 19459 | if (sema.fn_ret_ty_ies != null and sema.fn_ret_ty.zigTypeTag(mod) == .ErrorUnion) { |
| 19459 | try sema.addToInferredErrorSet(uncasted_operand); | 19460 | try sema.addToInferredErrorSet(uncasted_operand); |
| 19460 | } | 19461 | } |
| 19461 | const operand = sema.coerceExtra(block, sema.fn_ret_ty, uncasted_operand, src, .{ .is_ret = true }) catch |err| switch (err) { | 19462 | const operand = sema.coerceExtra(block, sema.fn_ret_ty, uncasted_operand, operand_src, .{ .is_ret = true }) catch |err| switch (err) { |
| 19462 | error.NotCoercible => unreachable, | 19463 | error.NotCoercible => unreachable, |
| 19463 | else => |e| return e, | 19464 | else => |e| return e, |
| 19464 | }; | 19465 | }; |
| 19465 | | 19466 | |
| 19466 | if (block.inlining) |inlining| { | 19467 | if (block.inlining) |inlining| { |
| 19467 | if (block.is_comptime) { | 19468 | if (block.is_comptime) { |
| 19468 | const ret_val = try sema.resolveConstValue(block, src, operand, .{ | 19469 | const ret_val = try sema.resolveConstValue(block, operand_src, operand, .{ |
| 19469 | .needed_comptime_reason = "value being returned at comptime must be comptime-known", | 19470 | .needed_comptime_reason = "value being returned at comptime must be comptime-known", |
| 19470 | }); | 19471 | }); |
| 19471 | inlining.comptime_result = operand; | 19472 | inlining.comptime_result = operand; |
| ... | @@ -19500,7 +19501,7 @@ fn analyzeRet( | ... | @@ -19500,7 +19501,7 @@ fn analyzeRet( |
| 19500 | if (sema.wantErrorReturnTracing(sema.fn_ret_ty)) { | 19501 | if (sema.wantErrorReturnTracing(sema.fn_ret_ty)) { |
| 19501 | // Avoid adding a frame to the error return trace in case the value is comptime-known | 19502 | // Avoid adding a frame to the error return trace in case the value is comptime-known |
| 19502 | // to be not an error. | 19503 | // to be not an error. |
| 19503 | const is_non_err = try sema.analyzeIsNonErr(block, src, operand); | 19504 | const is_non_err = try sema.analyzeIsNonErr(block, operand_src, operand); |
| 19504 | return sema.retWithErrTracing(block, src, is_non_err, air_tag, operand); | 19505 | return sema.retWithErrTracing(block, src, is_non_err, air_tag, operand); |
| 19505 | } | 19506 | } |
| 19506 | | 19507 | |