mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
Sema: fix incorrect type in optional_payload instruction
Resolves: #22417
This commit is contained in:
parent
82e7f23c49
commit
137787edbb
1 changed files with 3 additions and 2 deletions
|
|
@ -32735,7 +32735,8 @@ fn analyzeOptionalSlicePtr(
|
||||||
) CompileError!Air.Inst.Ref {
|
) CompileError!Air.Inst.Ref {
|
||||||
const pt = sema.pt;
|
const pt = sema.pt;
|
||||||
const zcu = pt.zcu;
|
const zcu = pt.zcu;
|
||||||
const result_ty = opt_slice_ty.optionalChild(zcu).slicePtrFieldType(zcu);
|
const slice_ty = opt_slice_ty.optionalChild(zcu);
|
||||||
|
const result_ty = slice_ty.slicePtrFieldType(zcu);
|
||||||
|
|
||||||
if (try sema.resolveValue(opt_slice)) |opt_val| {
|
if (try sema.resolveValue(opt_slice)) |opt_val| {
|
||||||
if (opt_val.isUndef(zcu)) return pt.undefRef(result_ty);
|
if (opt_val.isUndef(zcu)) return pt.undefRef(result_ty);
|
||||||
|
|
@ -32749,7 +32750,7 @@ fn analyzeOptionalSlicePtr(
|
||||||
|
|
||||||
try sema.requireRuntimeBlock(block, opt_slice_src, null);
|
try sema.requireRuntimeBlock(block, opt_slice_src, null);
|
||||||
|
|
||||||
const slice = try block.addTyOp(.optional_payload, opt_slice_ty, opt_slice);
|
const slice = try block.addTyOp(.optional_payload, slice_ty, opt_slice);
|
||||||
return block.addTyOp(.slice_ptr, result_ty, slice);
|
return block.addTyOp(.slice_ptr, result_ty, slice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue