| ... | ... | @@ -12371,7 +12371,7 @@ fn zirIntToPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 12371 | 12371 | const type_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 12372 | 12372 | const type_res = try sema.resolveType(block, src, extra.lhs); |
| 12373 | 12373 | try sema.checkPtrType(block, type_src, type_res); |
| 12374 | | _ = try sema.resolveTypeLayout(block, src, type_res.childType()); |
| 12374 | try sema.resolveTypeLayout(block, src, type_res.elemType2()); |
| 12375 | 12375 | const ptr_align = type_res.ptrAlignment(sema.mod.getTarget()); |
| 12376 | 12376 | |
| 12377 | 12377 | if (try sema.resolveDefinedValue(block, operand_src, operand_coerced)) |val| { |
| ... | ... | @@ -15512,6 +15512,14 @@ fn coerce( |
| 15512 | 15512 | return sema.addConstant(dest_ty, Value.@"null"); |
| 15513 | 15513 | } |
| 15514 | 15514 | |
| 15515 | // cast from ?*T and ?[*]T to ?*anyopaque |
| 15516 | // but don't do it if the source type is a double pointer |
| 15517 | if (dest_ty.isPtrLikeOptional() and dest_ty.elemType2().tag() == .anyopaque and |
| 15518 | inst_ty.isPtrLikeOptional() and inst_ty.elemType2().zigTypeTag() != .Pointer) |
| 15519 | { |
| 15520 | return sema.coerceCompatiblePtrs(block, dest_ty, inst, inst_src); |
| 15521 | } |
| 15522 | |
| 15515 | 15523 | // T to ?T |
| 15516 | 15524 | const child_type = try dest_ty.optionalChildAlloc(sema.arena); |
| 15517 | 15525 | const intermediate = try sema.coerce(block, child_type, inst, inst_src); |
| ... | ... | @@ -16791,6 +16799,7 @@ fn coerceCompatiblePtrs( |
| 16791 | 16799 | inst: Air.Inst.Ref, |
| 16792 | 16800 | inst_src: LazySrcLoc, |
| 16793 | 16801 | ) !Air.Inst.Ref { |
| 16802 | // TODO check const/volatile/alignment |
| 16794 | 16803 | if (try sema.resolveMaybeUndefVal(block, inst_src, inst)) |val| { |
| 16795 | 16804 | // The comptime Value representation is compatible with both types. |
| 16796 | 16805 | return sema.addConstant(dest_ty, val); |
| ... | ... | @@ -18506,6 +18515,7 @@ fn resolveInferredErrorSet(sema: *Sema, inferred_error_set: *Module.Fn.InferredE |
| 18506 | 18515 | if (inferred_error_set.is_resolved) { |
| 18507 | 18516 | return; |
| 18508 | 18517 | } |
| 18518 | inferred_error_set.is_resolved = true; |
| 18509 | 18519 | |
| 18510 | 18520 | var it = inferred_error_set.inferred_error_sets.keyIterator(); |
| 18511 | 18521 | while (it.next()) |other_error_set_ptr| { |
| ... | ... | @@ -18526,8 +18536,6 @@ fn resolveInferredErrorSet(sema: *Sema, inferred_error_set: *Module.Fn.InferredE |
| 18526 | 18536 | if (other_error_set_ptr.*.is_anyerror) |
| 18527 | 18537 | inferred_error_set.is_anyerror = true; |
| 18528 | 18538 | } |
| 18529 | | |
| 18530 | | inferred_error_set.is_resolved = true; |
| 18531 | 18539 | } |
| 18532 | 18540 | |
| 18533 | 18541 | fn resolveInferredErrorSetTy(sema: *Sema, ty: Type) CompileError!void { |