| ... | @@ -3035,10 +3035,11 @@ fn analyzeBlockBody( | ... | @@ -3035,10 +3035,11 @@ fn analyzeBlockBody( |
| 3035 | // to emit a jump instruction to after the block when it encounters the break. | 3035 | // to emit a jump instruction to after the block when it encounters the break. |
| 3036 | try parent_block.instructions.append(gpa, merges.block_inst); | 3036 | try parent_block.instructions.append(gpa, merges.block_inst); |
| 3037 | const resolved_ty = try sema.resolvePeerTypes(parent_block, src, merges.results.items, .none); | 3037 | const resolved_ty = try sema.resolvePeerTypes(parent_block, src, merges.results.items, .none); |
| | 3038 | const ty_inst = try sema.addType(resolved_ty); |
| 3038 | try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).Struct.fields.len + | 3039 | try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).Struct.fields.len + |
| 3039 | child_block.instructions.items.len); | 3040 | child_block.instructions.items.len); |
| 3040 | sema.air_instructions.items(.data)[merges.block_inst] = .{ .ty_pl = .{ | 3041 | sema.air_instructions.items(.data)[merges.block_inst] = .{ .ty_pl = .{ |
| 3041 | .ty = try sema.addType(resolved_ty), | 3042 | .ty = ty_inst, |
| 3042 | .payload = sema.addExtraAssumeCapacity(Air.Block{ | 3043 | .payload = sema.addExtraAssumeCapacity(Air.Block{ |
| 3043 | .body_len = @intCast(u32, child_block.instructions.items.len), | 3044 | .body_len = @intCast(u32, child_block.instructions.items.len), |
| 3044 | }), | 3045 | }), |
| ... | @@ -4666,7 +4667,16 @@ fn zirOptionalPayload( | ... | @@ -4666,7 +4667,16 @@ fn zirOptionalPayload( |
| 4666 | if (operand_ty.ptrSize() != .C) { | 4667 | if (operand_ty.ptrSize() != .C) { |
| 4667 | return sema.failWithExpectedOptionalType(block, src, operand_ty); | 4668 | return sema.failWithExpectedOptionalType(block, src, operand_ty); |
| 4668 | } | 4669 | } |
| 4669 | break :t operand_ty; | 4670 | const ptr_info = operand_ty.ptrInfo().data; |
| | 4671 | break :t try Type.ptr(sema.arena, .{ |
| | 4672 | .pointee_type = try ptr_info.pointee_type.copy(sema.arena), |
| | 4673 | .@"align" = ptr_info.@"align", |
| | 4674 | .@"addrspace" = ptr_info.@"addrspace", |
| | 4675 | .mutable = ptr_info.mutable, |
| | 4676 | .@"allowzero" = ptr_info.@"allowzero", |
| | 4677 | .@"volatile" = ptr_info.@"volatile", |
| | 4678 | .size = .One, |
| | 4679 | }); |
| 4670 | }, | 4680 | }, |
| 4671 | else => return sema.failWithExpectedOptionalType(block, src, operand_ty), | 4681 | else => return sema.failWithExpectedOptionalType(block, src, operand_ty), |
| 4672 | }; | 4682 | }; |