From 078e100573443488837e317b64bf00c704ee2a46 Mon Sep 17 00:00:00 2001 From: Justus Klausecker Date: Sat, 10 Jan 2026 18:18:48 +0100 Subject: [PATCH] wasm: fix getting pointer type instead of error union type for `is_err_ptr` --- src/codegen/wasm/CodeGen.zig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/codegen/wasm/CodeGen.zig b/src/codegen/wasm/CodeGen.zig index 5799ee614d5d9c8e1c42e611f660468277c3a939..b6f8145875b6abe0f63dee3eecf0d791295ba3fc 100644 --- a/src/codegen/wasm/CodeGen.zig +++ b/src/codegen/wasm/CodeGen.zig @@ -4114,7 +4114,10 @@ fn airIsErr(cg: *CodeGen, inst: Air.Inst.Index, opcode: std.wasm.Opcode, op_kind const zcu = cg.pt.zcu; const un_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].un_op; const operand = try cg.resolveInst(un_op); - const err_union_ty = cg.typeOf(un_op); + const err_union_ty = switch (op_kind) { + .value => cg.typeOf(un_op), + .ptr => cg.typeOf(un_op).childType(zcu), + }; const pl_ty = err_union_ty.errorUnionPayload(zcu); const result: WValue = result: { -- 2.54.0