aboutsummaryrefslogtreecommitdiff
path: root/src/Sema.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-05-31 15:19:25 -0400
committerGitHub <noreply@github.com>2022-05-31 15:19:25 -0400
commitd09d61be979fc97233bd53d9d082a86e4dcd9779 (patch)
tree502e0476e43e1a8ea0e0dd9e48e9fb8f76d1dd7c /src/Sema.zig
parentd410693dadfe791e616e78239fa0cec707b95cfa (diff)
parent282437c7538e3e70ce06cfee7affe976de28a780 (diff)
downloadzig-d09d61be979fc97233bd53d9d082a86e4dcd9779.tar.gz
zig-d09d61be979fc97233bd53d9d082a86e4dcd9779.zip
Merge pull request #11762 from Vexu/stage2
Stage2 fixes
Diffstat (limited to 'src/Sema.zig')
-rw-r--r--src/Sema.zig9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Sema.zig b/src/Sema.zig
index 505810a158..d4c49973a1 100644
--- a/src/Sema.zig
+++ b/src/Sema.zig
@@ -2976,7 +2976,7 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com
// Even though we reuse the constant instruction, we still remove it from the
// block so that codegen does not see it.
- block.instructions.shrinkRetainingCapacity(block.instructions.items.len - 3);
+ block.instructions.shrinkRetainingCapacity(search_index);
sema.air_values.items[value_index] = try Value.Tag.decl_ref.create(sema.arena, new_decl_index);
// if bitcast ty ref needs to be made const, make_ptr_const
// ZIR handles it later, so we can just use the ty ref here.
@@ -13011,10 +13011,13 @@ fn analyzeRet(
const backend_supports_error_return_tracing =
sema.mod.comp.bin_file.options.use_llvm;
- if ((sema.fn_ret_ty.zigTypeTag() == .ErrorSet or sema.typeOf(uncasted_operand).zigTypeTag() == .ErrorUnion) and
+ if (sema.fn_ret_ty.isError() and
sema.mod.comp.bin_file.options.error_return_tracing and
backend_supports_error_return_tracing)
- {
+ ret_err: {
+ if (try sema.resolveMaybeUndefVal(block, src, operand)) |ret_val| {
+ if (ret_val.tag() != .@"error") break :ret_err;
+ }
const return_err_fn = try sema.getBuiltin(block, src, "returnError");
const unresolved_stack_trace_ty = try sema.getBuiltinType(block, src, "StackTrace");
const stack_trace_ty = try sema.resolveTypeFields(block, src, unresolved_stack_trace_ty);