| ... | ... | @@ -1887,7 +1887,7 @@ pub fn setupErrorReturnTrace(sema: *Sema, block: *Block, last_arg_index: usize) |
| 1887 | 1887 | var err_trace_block = block.makeSubBlock(); |
| 1888 | 1888 | defer err_trace_block.instructions.deinit(gpa); |
| 1889 | 1889 | |
| 1890 | | const src: LazySrcLoc = .unneeded; |
| 1890 | const src = LazySrcLoc.un(); |
| 1891 | 1891 | |
| 1892 | 1892 | // var addrs: [err_return_trace_addr_count]usize = undefined; |
| 1893 | 1893 | const err_return_trace_addr_count = 32; |
| ... | ... | @@ -2913,7 +2913,7 @@ fn createAnonymousDeclTypeNamed( |
| 2913 | 2913 | // If not then this is a struct type being returned from a non-generic |
| 2914 | 2914 | // function and the name doesn't matter since it will later |
| 2915 | 2915 | // result in a compile error. |
| 2916 | | const arg_val = sema.resolveConstMaybeUndefVal(block, .unneeded, arg, "") catch |
| 2916 | const arg_val = sema.resolveConstMaybeUndefVal(block, LazySrcLoc.un(), arg, "") catch |
| 2917 | 2917 | return sema.createAnonymousDeclTypeNamed(block, src, typed_value, .anon, anon_prefix, null); |
| 2918 | 2918 | |
| 2919 | 2919 | if (arg_i != 0) try writer.writeByte(','); |
| ... | ... | @@ -3161,7 +3161,7 @@ fn zirEnumDecl( |
| 3161 | 3161 | const tag_val_ref = @as(Zir.Inst.Ref, @enumFromInt(sema.code.extra[extra_index])); |
| 3162 | 3162 | extra_index += 1; |
| 3163 | 3163 | const tag_inst = try sema.resolveInst(tag_val_ref); |
| 3164 | | last_tag_val = sema.resolveConstValue(block, .unneeded, tag_inst, "") catch |err| switch (err) { |
| 3164 | last_tag_val = sema.resolveConstValue(block, LazySrcLoc.un(), tag_inst, "") catch |err| switch (err) { |
| 3165 | 3165 | error.NeededSourceLocation => { |
| 3166 | 3166 | const value_src = mod.fieldSrcLoc(new_decl_index, .{ |
| 3167 | 3167 | .index = field_i, |
| ... | ... | @@ -5834,7 +5834,7 @@ fn zirExport(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void |
| 5834 | 5834 | break :index_blk maybe_index orelse |
| 5835 | 5835 | return sema.failWithBadMemberAccess(block, container_ty, operand_src, decl_name); |
| 5836 | 5836 | } else try sema.lookupIdentifier(block, operand_src, decl_name); |
| 5837 | | const options = sema.resolveExportOptions(block, .unneeded, extra.options) catch |err| switch (err) { |
| 5837 | const options = sema.resolveExportOptions(block, LazySrcLoc.un(), extra.options) catch |err| switch (err) { |
| 5838 | 5838 | error.NeededSourceLocation => { |
| 5839 | 5839 | _ = try sema.resolveExportOptions(block, options_src, extra.options); |
| 5840 | 5840 | unreachable; |
| ... | ... | @@ -5861,7 +5861,7 @@ fn zirExportValue(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 5861 | 5861 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 5862 | 5862 | const options_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; |
| 5863 | 5863 | const operand = try sema.resolveInstConst(block, operand_src, extra.operand, "export target must be comptime-known"); |
| 5864 | | const options = sema.resolveExportOptions(block, .unneeded, extra.options) catch |err| switch (err) { |
| 5864 | const options = sema.resolveExportOptions(block, LazySrcLoc.un(), extra.options) catch |err| switch (err) { |
| 5865 | 5865 | error.NeededSourceLocation => { |
| 5866 | 5866 | _ = try sema.resolveExportOptions(block, options_src, extra.options); |
| 5867 | 5867 | unreachable; |
| ... | ... | @@ -6995,7 +6995,7 @@ fn analyzeCall( |
| 6995 | 6995 | sema.analyzeInlineCallArg( |
| 6996 | 6996 | block, |
| 6997 | 6997 | &child_block, |
| 6998 | | .unneeded, |
| 6998 | LazySrcLoc.un(), |
| 6999 | 6999 | inst, |
| 7000 | 7000 | &new_fn_info, |
| 7001 | 7001 | &arg_i, |
| ... | ... | @@ -7141,7 +7141,7 @@ fn analyzeCall( |
| 7141 | 7141 | } |
| 7142 | 7142 | |
| 7143 | 7143 | if (should_memoize and is_comptime_call) { |
| 7144 | | const result_val = try sema.resolveConstMaybeUndefVal(block, .unneeded, result, ""); |
| 7144 | const result_val = try sema.resolveConstMaybeUndefVal(block, LazySrcLoc.un(), result, ""); |
| 7145 | 7145 | |
| 7146 | 7146 | // TODO: check whether any external comptime memory was mutated by the |
| 7147 | 7147 | // comptime function call. If so, then do not memoize the call here. |
| ... | ... | @@ -7171,7 +7171,7 @@ fn analyzeCall( |
| 7171 | 7171 | const param_ty = mod.typeToFunc(func_ty).?.param_types[i].toType(); |
| 7172 | 7172 | args[i] = sema.analyzeCallArg( |
| 7173 | 7173 | block, |
| 7174 | | .unneeded, |
| 7174 | LazySrcLoc.un(), |
| 7175 | 7175 | param_ty, |
| 7176 | 7176 | uncasted_arg, |
| 7177 | 7177 | opts, |
| ... | ... | @@ -7190,7 +7190,7 @@ fn analyzeCall( |
| 7190 | 7190 | else => |e| return e, |
| 7191 | 7191 | }; |
| 7192 | 7192 | } else { |
| 7193 | | args[i] = sema.coerceVarArgParam(block, uncasted_arg, .unneeded) catch |err| switch (err) { |
| 7193 | args[i] = sema.coerceVarArgParam(block, uncasted_arg, LazySrcLoc.un()) catch |err| switch (err) { |
| 7194 | 7194 | error.NeededSourceLocation => { |
| 7195 | 7195 | const decl = mod.declPtr(block.src_decl); |
| 7196 | 7196 | _ = try sema.coerceVarArgParam( |
| ... | ... | @@ -7608,7 +7608,7 @@ fn instantiateGenericCall( |
| 7608 | 7608 | } |
| 7609 | 7609 | |
| 7610 | 7610 | if (is_comptime) { |
| 7611 | | const casted_arg = sema.analyzeGenericCallArgVal(block, .unneeded, arg_ty.toType(), uncasted_arg, "") catch |err| switch (err) { |
| 7611 | const casted_arg = sema.analyzeGenericCallArgVal(block, LazySrcLoc.un(), arg_ty.toType(), uncasted_arg, "") catch |err| switch (err) { |
| 7612 | 7612 | error.NeededSourceLocation => { |
| 7613 | 7613 | const decl = mod.declPtr(block.src_decl); |
| 7614 | 7614 | const arg_src = mod.argSrc(call_src.node_offset.x, decl, arg_i, bound_arg_src); |
| ... | ... | @@ -7741,7 +7741,7 @@ fn instantiateGenericCall( |
| 7741 | 7741 | } |
| 7742 | 7742 | sema.analyzeGenericCallArg( |
| 7743 | 7743 | block, |
| 7744 | | .unneeded, |
| 7744 | LazySrcLoc.un(), |
| 7745 | 7745 | uncasted_args[total_i], |
| 7746 | 7746 | comptime_args[total_i], |
| 7747 | 7747 | runtime_args, |
| ... | ... | @@ -7893,7 +7893,7 @@ fn resolveGenericInstantiationType( |
| 7893 | 7893 | } else if (is_anytype) { |
| 7894 | 7894 | const arg_ty = sema.typeOf(arg); |
| 7895 | 7895 | if (try sema.typeRequiresComptime(arg_ty)) { |
| 7896 | | const arg_val = sema.resolveConstValue(block, .unneeded, arg, "") catch |err| switch (err) { |
| 7896 | const arg_val = sema.resolveConstValue(block, LazySrcLoc.un(), arg, "") catch |err| switch (err) { |
| 7897 | 7897 | error.NeededSourceLocation => { |
| 7898 | 7898 | const decl = mod.declPtr(block.src_decl); |
| 7899 | 7899 | const arg_src = mod.argSrc(call_src.node_offset.x, decl, arg_i, bound_arg_src); |
| ... | ... | @@ -7927,7 +7927,7 @@ fn resolveGenericInstantiationType( |
| 7927 | 7927 | child_block.error_return_trace_index = error_return_trace_index; |
| 7928 | 7928 | |
| 7929 | 7929 | const new_func_inst = try child_sema.resolveBody(&child_block, fn_info.param_body, fn_info.param_body_inst); |
| 7930 | | const new_func_val = child_sema.resolveConstValue(&child_block, .unneeded, new_func_inst, undefined) catch unreachable; |
| 7930 | const new_func_val = child_sema.resolveConstValue(&child_block, LazySrcLoc.un(), new_func_inst, undefined) catch unreachable; |
| 7931 | 7931 | const new_func = new_func_val.getFunctionIndex(mod).unwrap().?; |
| 7932 | 7932 | assert(new_func == new_module_func); |
| 7933 | 7933 | |
| ... | ... | @@ -8091,7 +8091,7 @@ fn zirOptionalType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro |
| 8091 | 8091 | fn zirElemTypeIndex(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8092 | 8092 | const mod = sema.mod; |
| 8093 | 8093 | const bin = sema.code.instructions.items(.data)[inst].bin; |
| 8094 | | const indexable_ty = try sema.resolveType(block, .unneeded, bin.lhs); |
| 8094 | const indexable_ty = try sema.resolveType(block, LazySrcLoc.un(), bin.lhs); |
| 8095 | 8095 | assert(indexable_ty.isIndexable(mod)); // validated by a previous instruction |
| 8096 | 8096 | if (indexable_ty.zigTypeTag(mod) == .Struct) { |
| 8097 | 8097 | const elem_type = indexable_ty.structFieldType(@intFromEnum(bin.rhs), mod); |
| ... | ... | @@ -8105,7 +8105,7 @@ fn zirElemTypeIndex(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr |
| 8105 | 8105 | fn zirElemType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8106 | 8106 | const mod = sema.mod; |
| 8107 | 8107 | const un_node = sema.code.instructions.items(.data)[inst].un_node; |
| 8108 | | const ptr_ty = try sema.resolveType(block, .unneeded, un_node.operand); |
| 8108 | const ptr_ty = try sema.resolveType(block, LazySrcLoc.un(), un_node.operand); |
| 8109 | 8109 | assert(ptr_ty.zigTypeTag(mod) == .Pointer); // validated by a previous instruction |
| 8110 | 8110 | return sema.addType(ptr_ty.childType(mod)); |
| 8111 | 8111 | } |
| ... | ... | @@ -9101,7 +9101,7 @@ fn funcCommon( |
| 9101 | 9101 | dest_param_ty.* = param.ty.toIntern(); |
| 9102 | 9102 | sema.analyzeParameter( |
| 9103 | 9103 | block, |
| 9104 | | .unneeded, |
| 9104 | LazySrcLoc.un(), |
| 9105 | 9105 | param, |
| 9106 | 9106 | &comptime_bits, |
| 9107 | 9107 | i, |
| ... | ... | @@ -9500,7 +9500,7 @@ fn zirParam( |
| 9500 | 9500 | if (is_comptime and sema.preallocated_new_func != .none) { |
| 9501 | 9501 | // We have a comptime value for this parameter so it should be elided from the |
| 9502 | 9502 | // function type of the function instruction in this block. |
| 9503 | | const coerced_arg = sema.coerce(block, param_ty, arg, .unneeded) catch |err| switch (err) { |
| 9503 | const coerced_arg = sema.coerce(block, param_ty, arg, LazySrcLoc.un()) catch |err| switch (err) { |
| 9504 | 9504 | error.NeededSourceLocation => { |
| 9505 | 9505 | // We are instantiating a generic function and a comptime arg |
| 9506 | 9506 | // cannot be coerced to the param type, but since we don't |
| ... | ... | @@ -10169,7 +10169,7 @@ fn zirSliceStart(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError! |
| 10169 | 10169 | const start_src: LazySrcLoc = .{ .node_offset_slice_start = inst_data.src_node }; |
| 10170 | 10170 | const end_src: LazySrcLoc = .{ .node_offset_slice_end = inst_data.src_node }; |
| 10171 | 10171 | |
| 10172 | | return sema.analyzeSlice(block, src, array_ptr, start, .none, .none, .unneeded, ptr_src, start_src, end_src, false); |
| 10172 | return sema.analyzeSlice(block, src, array_ptr, start, .none, .none, LazySrcLoc.un(), ptr_src, start_src, end_src, false); |
| 10173 | 10173 | } |
| 10174 | 10174 | |
| 10175 | 10175 | fn zirSliceEnd(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| ... | ... | @@ -10186,7 +10186,7 @@ fn zirSliceEnd(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 10186 | 10186 | const start_src: LazySrcLoc = .{ .node_offset_slice_start = inst_data.src_node }; |
| 10187 | 10187 | const end_src: LazySrcLoc = .{ .node_offset_slice_end = inst_data.src_node }; |
| 10188 | 10188 | |
| 10189 | | return sema.analyzeSlice(block, src, array_ptr, start, end, .none, .unneeded, ptr_src, start_src, end_src, false); |
| 10189 | return sema.analyzeSlice(block, src, array_ptr, start, end, .none, LazySrcLoc.un(), ptr_src, start_src, end_src, false); |
| 10190 | 10190 | } |
| 10191 | 10191 | |
| 10192 | 10192 | fn zirSliceSentinel(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| ... | ... | @@ -10223,7 +10223,7 @@ fn zirSliceLength(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 10223 | 10223 | const start_src: LazySrcLoc = .{ .node_offset_slice_start = extra.start_src_node_offset }; |
| 10224 | 10224 | const end_src: LazySrcLoc = .{ .node_offset_slice_end = inst_data.src_node }; |
| 10225 | 10225 | const sentinel_src: LazySrcLoc = if (sentinel == .none) |
| 10226 | | .unneeded |
| 10226 | LazySrcLoc.un() |
| 10227 | 10227 | else |
| 10228 | 10228 | .{ .node_offset_slice_sentinel = inst_data.src_node }; |
| 10229 | 10229 | |
| ... | ... | @@ -10418,7 +10418,7 @@ const SwitchProngAnalysis = struct { |
| 10418 | 10418 | const operand_src: LazySrcLoc = .{ .node_offset_switch_operand = switch_node_offset }; |
| 10419 | 10419 | |
| 10420 | 10420 | if (inline_case_capture != .none) { |
| 10421 | | const item_val = sema.resolveConstValue(block, .unneeded, inline_case_capture, "") catch unreachable; |
| 10421 | const item_val = sema.resolveConstValue(block, LazySrcLoc.un(), inline_case_capture, "") catch unreachable; |
| 10422 | 10422 | if (operand_ty.zigTypeTag(mod) == .Union) { |
| 10423 | 10423 | const field_index = @as(u32, @intCast(operand_ty.unionTagFieldIndex(item_val, mod).?)); |
| 10424 | 10424 | const union_obj = mod.typeToUnion(operand_ty).?; |
| ... | ... | @@ -10477,15 +10477,15 @@ const SwitchProngAnalysis = struct { |
| 10477 | 10477 | switch (operand_ty.zigTypeTag(mod)) { |
| 10478 | 10478 | .Union => { |
| 10479 | 10479 | const union_obj = mod.typeToUnion(operand_ty).?; |
| 10480 | | const first_item_val = sema.resolveConstValue(block, .unneeded, case_vals[0], "") catch unreachable; |
| 10480 | const first_item_val = sema.resolveConstValue(block, LazySrcLoc.un(), case_vals[0], "") catch unreachable; |
| 10481 | 10481 | |
| 10482 | 10482 | const first_field_index = @as(u32, @intCast(operand_ty.unionTagFieldIndex(first_item_val, mod).?)); |
| 10483 | 10483 | const first_field = union_obj.fields.values()[first_field_index]; |
| 10484 | 10484 | |
| 10485 | 10485 | const field_tys = try sema.arena.alloc(Type, case_vals.len); |
| 10486 | 10486 | for (case_vals, field_tys) |item, *field_ty| { |
| 10487 | | const item_val = sema.resolveConstValue(block, .unneeded, item, "") catch unreachable; |
| 10488 | | const field_idx = @as(u32, @intCast(operand_ty.unionTagFieldIndex(item_val, sema.mod).?)); |
| 10487 | const item_val = sema.resolveConstValue(block, LazySrcLoc.un(), item, "") catch unreachable; |
| 10488 | const field_idx: u32 = @intCast(operand_ty.unionTagFieldIndex(item_val, sema.mod).?); |
| 10489 | 10489 | field_ty.* = union_obj.fields.values()[field_idx].ty; |
| 10490 | 10490 | } |
| 10491 | 10491 | |
| ... | ... | @@ -10503,9 +10503,9 @@ const SwitchProngAnalysis = struct { |
| 10503 | 10503 | } |
| 10504 | 10504 | |
| 10505 | 10505 | const case_srcs = try sema.arena.alloc(?LazySrcLoc, case_vals.len); |
| 10506 | | @memset(case_srcs, .unneeded); |
| 10506 | @memset(case_srcs, LazySrcLoc.un()); |
| 10507 | 10507 | |
| 10508 | | break :capture_ty sema.resolvePeerTypes(block, .unneeded, dummy_captures, .{ .override = case_srcs }) catch |err| switch (err) { |
| 10508 | break :capture_ty sema.resolvePeerTypes(block, LazySrcLoc.un(), dummy_captures, .{ .override = case_srcs }) catch |err| switch (err) { |
| 10509 | 10509 | error.NeededSourceLocation => { |
| 10510 | 10510 | // This must be a multi-prong so this must be a `multi_capture` src |
| 10511 | 10511 | const multi_idx = raw_capture_src.multi_capture; |
| ... | ... | @@ -10555,7 +10555,7 @@ const SwitchProngAnalysis = struct { |
| 10555 | 10555 | .address_space = operand_ptr_info.flags.address_space, |
| 10556 | 10556 | }, |
| 10557 | 10557 | }); |
| 10558 | | if (.ok != try sema.coerceInMemoryAllowed(block, capture_ptr_ty, field_ptr_ty, false, sema.mod.getTarget(), .unneeded, .unneeded)) { |
| 10558 | if (.ok != try sema.coerceInMemoryAllowed(block, capture_ptr_ty, field_ptr_ty, false, sema.mod.getTarget(), LazySrcLoc.un(), LazySrcLoc.un())) { |
| 10559 | 10559 | const multi_idx = raw_capture_src.multi_capture; |
| 10560 | 10560 | const src_decl_ptr = sema.mod.declPtr(block.src_decl); |
| 10561 | 10561 | const capture_src = raw_capture_src.resolve(mod, src_decl_ptr, switch_node_offset, .none); |
| ... | ... | @@ -10611,7 +10611,7 @@ const SwitchProngAnalysis = struct { |
| 10611 | 10611 | // If we can, try to avoid that using in-memory coercions. |
| 10612 | 10612 | const first_non_imc = in_mem: { |
| 10613 | 10613 | for (field_tys, 0..) |field_ty, i| { |
| 10614 | | if (.ok != try sema.coerceInMemoryAllowed(block, capture_ty, field_ty, false, sema.mod.getTarget(), .unneeded, .unneeded)) { |
| 10614 | if (.ok != try sema.coerceInMemoryAllowed(block, capture_ty, field_ty, false, sema.mod.getTarget(), LazySrcLoc.un(), LazySrcLoc.un())) { |
| 10615 | 10615 | break :in_mem i; |
| 10616 | 10616 | } |
| 10617 | 10617 | } |
| ... | ... | @@ -10633,7 +10633,7 @@ const SwitchProngAnalysis = struct { |
| 10633 | 10633 | { |
| 10634 | 10634 | const next = first_non_imc + 1; |
| 10635 | 10635 | for (field_tys[next..], next..) |field_ty, i| { |
| 10636 | | if (.ok != try sema.coerceInMemoryAllowed(block, capture_ty, field_ty, false, sema.mod.getTarget(), .unneeded, .unneeded)) { |
| 10636 | if (.ok != try sema.coerceInMemoryAllowed(block, capture_ty, field_ty, false, sema.mod.getTarget(), LazySrcLoc.un(), LazySrcLoc.un())) { |
| 10637 | 10637 | in_mem_coercible.unset(i); |
| 10638 | 10638 | } |
| 10639 | 10639 | } |
| ... | ... | @@ -10662,8 +10662,8 @@ const SwitchProngAnalysis = struct { |
| 10662 | 10662 | var coerce_block = block.makeSubBlock(); |
| 10663 | 10663 | defer coerce_block.instructions.deinit(sema.gpa); |
| 10664 | 10664 | |
| 10665 | | const uncoerced = try coerce_block.addStructFieldVal(spa.operand, @as(u32, @intCast(idx)), field_tys[idx]); |
| 10666 | | const coerced = sema.coerce(&coerce_block, capture_ty, uncoerced, .unneeded) catch |err| switch (err) { |
| 10665 | const uncoerced = try coerce_block.addStructFieldVal(spa.operand, @intCast(idx), field_tys[idx]); |
| 10666 | const coerced = sema.coerce(&coerce_block, capture_ty, uncoerced, LazySrcLoc.un()) catch |err| switch (err) { |
| 10667 | 10667 | error.NeededSourceLocation => { |
| 10668 | 10668 | const multi_idx = raw_capture_src.multi_capture; |
| 10669 | 10669 | const src_decl_ptr = sema.mod.declPtr(block.src_decl); |
| ... | ... | @@ -10735,7 +10735,7 @@ const SwitchProngAnalysis = struct { |
| 10735 | 10735 | } |
| 10736 | 10736 | |
| 10737 | 10737 | if (case_vals.len == 1) { |
| 10738 | | const item_val = sema.resolveConstValue(block, .unneeded, case_vals[0], "") catch unreachable; |
| 10738 | const item_val = sema.resolveConstValue(block, LazySrcLoc.un(), case_vals[0], "") catch unreachable; |
| 10739 | 10739 | const item_ty = try mod.singleErrorSetType(item_val.getErrorName(mod).unwrap().?); |
| 10740 | 10740 | return sema.bitCast(block, item_ty, spa.operand, operand_src, null); |
| 10741 | 10741 | } |
| ... | ... | @@ -10743,7 +10743,7 @@ const SwitchProngAnalysis = struct { |
| 10743 | 10743 | var names: Module.Fn.InferredErrorSet.NameMap = .{}; |
| 10744 | 10744 | try names.ensureUnusedCapacity(sema.arena, case_vals.len); |
| 10745 | 10745 | for (case_vals) |err| { |
| 10746 | | const err_val = sema.resolveConstValue(block, .unneeded, err, "") catch unreachable; |
| 10746 | const err_val = sema.resolveConstValue(block, LazySrcLoc.un(), err, "") catch unreachable; |
| 10747 | 10747 | names.putAssumeCapacityNoClobber(err_val.getErrorName(mod).unwrap().?, {}); |
| 10748 | 10748 | } |
| 10749 | 10749 | const error_ty = try mod.errorSetFromUnsortedNames(names.keys()); |
| ... | ... | @@ -11507,7 +11507,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r |
| 11507 | 11507 | extra_index += info.body_len; |
| 11508 | 11508 | |
| 11509 | 11509 | const item = case_vals.items[scalar_i]; |
| 11510 | | const item_val = sema.resolveConstValue(&child_block, .unneeded, item, "") catch unreachable; |
| 11510 | const item_val = sema.resolveConstValue(&child_block, LazySrcLoc.un(), item, "") catch unreachable; |
| 11511 | 11511 | if (operand_val.eql(item_val, operand_ty, sema.mod)) { |
| 11512 | 11512 | if (err_set) try sema.maybeErrorUnwrapComptime(&child_block, body, operand); |
| 11513 | 11513 | return spa.resolveProngComptime( |
| ... | ... | @@ -11541,7 +11541,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r |
| 11541 | 11541 | |
| 11542 | 11542 | for (items) |item| { |
| 11543 | 11543 | // Validation above ensured these will succeed. |
| 11544 | | const item_val = sema.resolveConstValue(&child_block, .unneeded, item, "") catch unreachable; |
| 11544 | const item_val = sema.resolveConstValue(&child_block, LazySrcLoc.un(), item, "") catch unreachable; |
| 11545 | 11545 | if (operand_val.eql(item_val, operand_ty, sema.mod)) { |
| 11546 | 11546 | if (err_set) try sema.maybeErrorUnwrapComptime(&child_block, body, operand); |
| 11547 | 11547 | return spa.resolveProngComptime( |
| ... | ... | @@ -11565,8 +11565,8 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r |
| 11565 | 11565 | case_val_idx += 2; |
| 11566 | 11566 | |
| 11567 | 11567 | // Validation above ensured these will succeed. |
| 11568 | | const first_val = sema.resolveConstValue(&child_block, .unneeded, range_items[0], "") catch unreachable; |
| 11569 | | const last_val = sema.resolveConstValue(&child_block, .unneeded, range_items[1], "") catch unreachable; |
| 11568 | const first_val = sema.resolveConstValue(&child_block, LazySrcLoc.un(), range_items[0], "") catch unreachable; |
| 11569 | const last_val = sema.resolveConstValue(&child_block, LazySrcLoc.un(), range_items[1], "") catch unreachable; |
| 11570 | 11570 | if ((try sema.compareAll(resolved_operand_val, .gte, first_val, operand_ty)) and |
| 11571 | 11571 | (try sema.compareAll(resolved_operand_val, .lte, last_val, operand_ty))) |
| 11572 | 11572 | { |
| ... | ... | @@ -11676,7 +11676,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r |
| 11676 | 11676 | // `item` is already guaranteed to be constant known. |
| 11677 | 11677 | |
| 11678 | 11678 | const analyze_body = if (union_originally) blk: { |
| 11679 | | const item_val = sema.resolveConstLazyValue(block, .unneeded, item, "") catch unreachable; |
| 11679 | const item_val = sema.resolveConstLazyValue(block, LazySrcLoc.un(), item, "") catch unreachable; |
| 11680 | 11680 | const field_ty = maybe_union_ty.unionFieldType(item_val, mod); |
| 11681 | 11681 | break :blk field_ty.zigTypeTag(mod) != .NoReturn; |
| 11682 | 11682 | } else true; |
| ... | ... | @@ -11746,8 +11746,8 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r |
| 11746 | 11746 | const item_first_ref = range_items[0]; |
| 11747 | 11747 | const item_last_ref = range_items[1]; |
| 11748 | 11748 | |
| 11749 | | var item = sema.resolveConstValue(block, .unneeded, item_first_ref, undefined) catch unreachable; |
| 11750 | | const item_last = sema.resolveConstValue(block, .unneeded, item_last_ref, undefined) catch unreachable; |
| 11749 | var item = sema.resolveConstValue(block, LazySrcLoc.un(), item_first_ref, undefined) catch unreachable; |
| 11750 | const item_last = sema.resolveConstValue(block, LazySrcLoc.un(), item_last_ref, undefined) catch unreachable; |
| 11751 | 11751 | |
| 11752 | 11752 | while (item.compareScalar(.lte, item_last, operand_ty, mod)) : ({ |
| 11753 | 11753 | // Previous validation has resolved any possible lazy values. |
| ... | ... | @@ -11763,7 +11763,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r |
| 11763 | 11763 | case_block.instructions.shrinkRetainingCapacity(0); |
| 11764 | 11764 | case_block.wip_capture_scope = child_block.wip_capture_scope; |
| 11765 | 11765 | |
| 11766 | | if (emit_bb) sema.emitBackwardBranch(block, .unneeded) catch |err| switch (err) { |
| 11766 | if (emit_bb) sema.emitBackwardBranch(block, LazySrcLoc.un()) catch |err| switch (err) { |
| 11767 | 11767 | error.NeededSourceLocation => { |
| 11768 | 11768 | const case_src = Module.SwitchProngSrc{ .range = .{ .prong = multi_i, .item = range_i } }; |
| 11769 | 11769 | const decl = mod.declPtr(case_block.src_decl); |
| ... | ... | @@ -11802,12 +11802,12 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r |
| 11802 | 11802 | case_block.wip_capture_scope = child_block.wip_capture_scope; |
| 11803 | 11803 | |
| 11804 | 11804 | const analyze_body = if (union_originally) blk: { |
| 11805 | | const item_val = sema.resolveConstValue(block, .unneeded, item, undefined) catch unreachable; |
| 11805 | const item_val = sema.resolveConstValue(block, LazySrcLoc.un(), item, undefined) catch unreachable; |
| 11806 | 11806 | const field_ty = maybe_union_ty.unionFieldType(item_val, mod); |
| 11807 | 11807 | break :blk field_ty.zigTypeTag(mod) != .NoReturn; |
| 11808 | 11808 | } else true; |
| 11809 | 11809 | |
| 11810 | | if (emit_bb) sema.emitBackwardBranch(block, .unneeded) catch |err| switch (err) { |
| 11810 | if (emit_bb) sema.emitBackwardBranch(block, LazySrcLoc.un()) catch |err| switch (err) { |
| 11811 | 11811 | error.NeededSourceLocation => { |
| 11812 | 11812 | const case_src = Module.SwitchProngSrc{ .multi = .{ .prong = multi_i, .item = @as(u32, @intCast(item_i)) } }; |
| 11813 | 11813 | const decl = mod.declPtr(case_block.src_decl); |
| ... | ... | @@ -11854,7 +11854,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r |
| 11854 | 11854 | |
| 11855 | 11855 | const analyze_body = if (union_originally) |
| 11856 | 11856 | for (items) |item| { |
| 11857 | | const item_val = sema.resolveConstValue(block, .unneeded, item, "") catch unreachable; |
| 11857 | const item_val = sema.resolveConstValue(block, LazySrcLoc.un(), item, "") catch unreachable; |
| 11858 | 11858 | const field_ty = maybe_union_ty.unionFieldType(item_val, mod); |
| 11859 | 11859 | if (field_ty.zigTypeTag(mod) != .NoReturn) break true; |
| 11860 | 11860 | } else false |
| ... | ... | @@ -12345,7 +12345,7 @@ fn resolveSwitchItemVal( |
| 12345 | 12345 | // Only if we know for sure we need to report a compile error do we resolve the |
| 12346 | 12346 | // full source locations. |
| 12347 | 12347 | |
| 12348 | | const item = sema.coerce(block, coerce_ty, uncoerced_item, .unneeded) catch |err| switch (err) { |
| 12348 | const item = sema.coerce(block, coerce_ty, uncoerced_item, LazySrcLoc.un()) catch |err| switch (err) { |
| 12349 | 12349 | error.NeededSourceLocation => { |
| 12350 | 12350 | const src = switch_prong_src.resolve(mod, mod.declPtr(block.src_decl), switch_node_offset, range_expand); |
| 12351 | 12351 | _ = try sema.coerce(block, coerce_ty, uncoerced_item, src); |
| ... | ... | @@ -12354,7 +12354,7 @@ fn resolveSwitchItemVal( |
| 12354 | 12354 | else => |e| return e, |
| 12355 | 12355 | }; |
| 12356 | 12356 | |
| 12357 | | const maybe_lazy = sema.resolveConstValue(block, .unneeded, item, "") catch |err| switch (err) { |
| 12357 | const maybe_lazy = sema.resolveConstValue(block, LazySrcLoc.un(), item, "") catch |err| switch (err) { |
| 12358 | 12358 | error.NeededSourceLocation => { |
| 12359 | 12359 | const src = switch_prong_src.resolve(mod, mod.declPtr(block.src_decl), switch_node_offset, range_expand); |
| 12360 | 12360 | _ = try sema.resolveConstValue(block, src, item, "switch prong values must be comptime-known"); |
| ... | ... | @@ -13479,8 +13479,8 @@ fn zirArrayCat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 13479 | 13479 | const elem_default_val = if (lhs_is_tuple) lhs_ty.structFieldDefaultValue(lhs_elem_i, mod) else Value.@"unreachable"; |
| 13480 | 13480 | const elem_val = if (elem_default_val.toIntern() == .unreachable_value) try lhs_sub_val.elemValue(mod, lhs_elem_i) else elem_default_val; |
| 13481 | 13481 | const elem_val_inst = try sema.addConstant(elem_val); |
| 13482 | | const coerced_elem_val_inst = try sema.coerce(block, resolved_elem_ty, elem_val_inst, .unneeded); |
| 13483 | | const coerced_elem_val = try sema.resolveConstMaybeUndefVal(block, .unneeded, coerced_elem_val_inst, ""); |
| 13482 | const coerced_elem_val_inst = try sema.coerce(block, resolved_elem_ty, elem_val_inst, LazySrcLoc.un()); |
| 13483 | const coerced_elem_val = try sema.resolveConstMaybeUndefVal(block, LazySrcLoc.un(), coerced_elem_val_inst, ""); |
| 13484 | 13484 | element_vals[elem_i] = try coerced_elem_val.intern(resolved_elem_ty, mod); |
| 13485 | 13485 | } |
| 13486 | 13486 | while (elem_i < result_len) : (elem_i += 1) { |
| ... | ... | @@ -13488,8 +13488,8 @@ fn zirArrayCat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 13488 | 13488 | const elem_default_val = if (rhs_is_tuple) rhs_ty.structFieldDefaultValue(rhs_elem_i, mod) else Value.@"unreachable"; |
| 13489 | 13489 | const elem_val = if (elem_default_val.toIntern() == .unreachable_value) try rhs_sub_val.elemValue(mod, rhs_elem_i) else elem_default_val; |
| 13490 | 13490 | const elem_val_inst = try sema.addConstant(elem_val); |
| 13491 | | const coerced_elem_val_inst = try sema.coerce(block, resolved_elem_ty, elem_val_inst, .unneeded); |
| 13492 | | const coerced_elem_val = try sema.resolveConstMaybeUndefVal(block, .unneeded, coerced_elem_val_inst, ""); |
| 13491 | const coerced_elem_val_inst = try sema.coerce(block, resolved_elem_ty, elem_val_inst, LazySrcLoc.un()); |
| 13492 | const coerced_elem_val = try sema.resolveConstMaybeUndefVal(block, LazySrcLoc.un(), coerced_elem_val_inst, ""); |
| 13493 | 13493 | element_vals[elem_i] = try coerced_elem_val.intern(resolved_elem_ty, mod); |
| 13494 | 13494 | } |
| 13495 | 13495 | return sema.addConstantMaybeRef(block, result_ty, (try mod.intern(.{ .aggregate = .{ |
| ... | ... | @@ -18361,7 +18361,7 @@ fn zirRetImplicit( |
| 18361 | 18361 | return sema.failWithOwnedErrorMsg(msg); |
| 18362 | 18362 | } |
| 18363 | 18363 | |
| 18364 | | return sema.analyzeRet(block, operand, .unneeded); |
| 18364 | return sema.analyzeRet(block, operand, LazySrcLoc.un()); |
| 18365 | 18365 | } |
| 18366 | 18366 | |
| 18367 | 18367 | fn zirRetNode(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Zir.Inst.Index { |
| ... | ... | @@ -19069,7 +19069,7 @@ fn finishStructInit( |
| 19069 | 19069 | return sema.makePtrConst(block, alloc); |
| 19070 | 19070 | } |
| 19071 | 19071 | |
| 19072 | | sema.requireRuntimeBlock(block, .unneeded, null) catch |err| switch (err) { |
| 19072 | sema.requireRuntimeBlock(block, LazySrcLoc.un(), null) catch |err| switch (err) { |
| 19073 | 19073 | error.NeededSourceLocation => { |
| 19074 | 19074 | const decl = mod.declPtr(block.src_decl); |
| 19075 | 19075 | const field_src = mod.initSrc(dest_src.node_offset.x, decl, runtime_index); |
| ... | ... | @@ -19163,7 +19163,7 @@ fn zirStructInitAnon( |
| 19163 | 19163 | return sema.addConstantMaybeRef(block, tuple_ty.toType(), tuple_val.toValue(), is_ref); |
| 19164 | 19164 | }; |
| 19165 | 19165 | |
| 19166 | | sema.requireRuntimeBlock(block, .unneeded, null) catch |err| switch (err) { |
| 19166 | sema.requireRuntimeBlock(block, LazySrcLoc.un(), null) catch |err| switch (err) { |
| 19167 | 19167 | error.NeededSourceLocation => { |
| 19168 | 19168 | const decl = mod.declPtr(block.src_decl); |
| 19169 | 19169 | const field_src = mod.initSrc(src.node_offset.x, decl, runtime_index); |
| ... | ... | @@ -19237,7 +19237,7 @@ fn zirArrayInit( |
| 19237 | 19237 | array_ty.structFieldType(i, mod) |
| 19238 | 19238 | else |
| 19239 | 19239 | array_ty.elemType2(mod); |
| 19240 | | resolved_args[i] = sema.coerce(block, elem_ty, resolved_arg, .unneeded) catch |err| switch (err) { |
| 19240 | resolved_args[i] = sema.coerce(block, elem_ty, resolved_arg, LazySrcLoc.un()) catch |err| switch (err) { |
| 19241 | 19241 | error.NeededSourceLocation => { |
| 19242 | 19242 | const decl = mod.declPtr(block.src_decl); |
| 19243 | 19243 | const elem_src = mod.initSrc(src.node_offset.x, decl, i); |
| ... | ... | @@ -19273,7 +19273,7 @@ fn zirArrayInit( |
| 19273 | 19273 | } })).toValue(), is_ref); |
| 19274 | 19274 | }; |
| 19275 | 19275 | |
| 19276 | | sema.requireRuntimeBlock(block, .unneeded, null) catch |err| switch (err) { |
| 19276 | sema.requireRuntimeBlock(block, LazySrcLoc.un(), null) catch |err| switch (err) { |
| 19277 | 19277 | error.NeededSourceLocation => { |
| 19278 | 19278 | const decl = mod.declPtr(block.src_decl); |
| 19279 | 19279 | const elem_src = mod.initSrc(src.node_offset.x, decl, runtime_index); |
| ... | ... | @@ -19667,7 +19667,7 @@ fn zirTagName(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 19667 | 19667 | try sema.resolveTypeLayout(operand_ty); |
| 19668 | 19668 | const enum_ty = switch (operand_ty.zigTypeTag(mod)) { |
| 19669 | 19669 | .EnumLiteral => { |
| 19670 | | const val = try sema.resolveConstValue(block, .unneeded, operand, ""); |
| 19670 | const val = try sema.resolveConstValue(block, LazySrcLoc.un(), operand, ""); |
| 19671 | 19671 | const tag_name = ip.indexToKey(val.toIntern()).enum_literal; |
| 19672 | 19672 | return sema.addStrLit(block, ip.stringToSlice(tag_name)); |
| 19673 | 19673 | }, |
| ... | ... | @@ -22213,7 +22213,7 @@ fn checkVectorizableBinaryOperands( |
| 22213 | 22213 | } |
| 22214 | 22214 | |
| 22215 | 22215 | fn maybeOptionsSrc(sema: *Sema, block: *Block, base_src: LazySrcLoc, wanted: []const u8) LazySrcLoc { |
| 22216 | | if (base_src == .unneeded) return .unneeded; |
| 22216 | if (base_src == .unneeded) return LazySrcLoc.un(); |
| 22217 | 22217 | const mod = sema.mod; |
| 22218 | 22218 | return mod.optionsSrc(mod.declPtr(block.src_decl), base_src, wanted); |
| 22219 | 22219 | } |
| ... | ... | @@ -23655,7 +23655,7 @@ fn zirMemcpy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void |
| 23655 | 23655 | } else if (dest_len == .none and len_val == null) { |
| 23656 | 23656 | // Change the dest to a slice, since its type must have the length. |
| 23657 | 23657 | const dest_ptr_ptr = try sema.analyzeRef(block, dest_src, new_dest_ptr); |
| 23658 | | new_dest_ptr = try sema.analyzeSlice(block, dest_src, dest_ptr_ptr, .zero, src_len, .none, .unneeded, dest_src, dest_src, dest_src, false); |
| 23658 | new_dest_ptr = try sema.analyzeSlice(block, dest_src, dest_ptr_ptr, .zero, src_len, .none, LazySrcLoc.un(), dest_src, dest_src, dest_src, false); |
| 23659 | 23659 | const new_src_ptr_ty = sema.typeOf(new_src_ptr); |
| 23660 | 23660 | if (new_src_ptr_ty.isSlice(mod)) { |
| 23661 | 23661 | new_src_ptr = try sema.analyzeSlicePtr(block, src_src, new_src_ptr, new_src_ptr_ty); |
| ... | ... | @@ -24221,7 +24221,7 @@ fn zirPrefetch( |
| 24221 | 24221 | const ptr = try sema.resolveInst(extra.lhs); |
| 24222 | 24222 | try sema.checkPtrOperand(block, ptr_src, sema.typeOf(ptr)); |
| 24223 | 24223 | |
| 24224 | | const options = sema.resolvePrefetchOptions(block, .unneeded, extra.rhs) catch |err| switch (err) { |
| 24224 | const options = sema.resolvePrefetchOptions(block, LazySrcLoc.un(), extra.rhs) catch |err| switch (err) { |
| 24225 | 24225 | error.NeededSourceLocation => { |
| 24226 | 24226 | _ = try sema.resolvePrefetchOptions(block, opts_src, extra.rhs); |
| 24227 | 24227 | unreachable; |
| ... | ... | @@ -24330,7 +24330,7 @@ fn zirBuiltinExtern( |
| 24330 | 24330 | return sema.failWithOwnedErrorMsg(msg); |
| 24331 | 24331 | } |
| 24332 | 24332 | |
| 24333 | | const options = sema.resolveExternOptions(block, .unneeded, extra.rhs) catch |err| switch (err) { |
| 24333 | const options = sema.resolveExternOptions(block, LazySrcLoc.un(), extra.rhs) catch |err| switch (err) { |
| 24334 | 24334 | error.NeededSourceLocation => { |
| 24335 | 24335 | _ = try sema.resolveExternOptions(block, options_src, extra.rhs); |
| 24336 | 24336 | unreachable; |
| ... | ... | @@ -25036,7 +25036,7 @@ fn panicWithMsg(sema: *Sema, block: *Block, msg_inst: Air.Inst.Ref) !void { |
| 25036 | 25036 | try sema.prepareSimplePanic(block); |
| 25037 | 25037 | |
| 25038 | 25038 | const panic_func = mod.funcPtrUnwrap(mod.panic_func_index).?; |
| 25039 | | const panic_fn = try sema.analyzeDeclVal(block, .unneeded, panic_func.owner_decl); |
| 25039 | const panic_fn = try sema.analyzeDeclVal(block, LazySrcLoc.un(), panic_func.owner_decl); |
| 25040 | 25040 | const null_stack_trace = try sema.addConstant(mod.null_stack_trace.toValue()); |
| 25041 | 25041 | |
| 25042 | 25042 | const opt_usize_ty = try mod.optionalType(.usize_type); |
| ... | ... | @@ -25530,7 +25530,7 @@ fn fieldPtr( |
| 25530 | 25530 | } |
| 25531 | 25531 | }, |
| 25532 | 25532 | .Type => { |
| 25533 | | _ = try sema.resolveConstValue(block, .unneeded, object_ptr, ""); |
| 25533 | _ = try sema.resolveConstValue(block, LazySrcLoc.un(), object_ptr, ""); |
| 25534 | 25534 | const result = try sema.analyzeLoad(block, src, object_ptr, object_ptr_src); |
| 25535 | 25535 | const inner = if (is_pointer_to) |
| 25536 | 25536 | try sema.analyzeLoad(block, src, result, object_ptr_src) |
| ... | ... | @@ -27026,7 +27026,7 @@ fn coerceExtra( |
| 27026 | 27026 | |
| 27027 | 27027 | // Function body to function pointer. |
| 27028 | 27028 | if (inst_ty.zigTypeTag(mod) == .Fn) { |
| 27029 | | const fn_val = try sema.resolveConstValue(block, .unneeded, inst, ""); |
| 27029 | const fn_val = try sema.resolveConstValue(block, LazySrcLoc.un(), inst, ""); |
| 27030 | 27030 | const fn_decl = fn_val.pointerDecl(mod).?; |
| 27031 | 27031 | const inst_as_ptr = try sema.analyzeDeclRef(fn_decl); |
| 27032 | 27032 | return sema.coerce(block, dest_ty, inst_as_ptr, inst_src); |
| ... | ... | @@ -27366,7 +27366,7 @@ fn coerceExtra( |
| 27366 | 27366 | }, |
| 27367 | 27367 | .Float, .ComptimeFloat => switch (inst_ty.zigTypeTag(mod)) { |
| 27368 | 27368 | .ComptimeFloat => { |
| 27369 | | const val = try sema.resolveConstValue(block, .unneeded, inst, ""); |
| 27369 | const val = try sema.resolveConstValue(block, LazySrcLoc.un(), inst, ""); |
| 27370 | 27370 | const result_val = try val.floatCast(dest_ty, mod); |
| 27371 | 27371 | return try sema.addConstant(result_val); |
| 27372 | 27372 | }, |
| ... | ... | @@ -27430,7 +27430,7 @@ fn coerceExtra( |
| 27430 | 27430 | .Enum => switch (inst_ty.zigTypeTag(mod)) { |
| 27431 | 27431 | .EnumLiteral => { |
| 27432 | 27432 | // enum literal to enum |
| 27433 | | const val = try sema.resolveConstValue(block, .unneeded, inst, ""); |
| 27433 | const val = try sema.resolveConstValue(block, LazySrcLoc.un(), inst, ""); |
| 27434 | 27434 | const string = mod.intern_pool.indexToKey(val.toIntern()).enum_literal; |
| 27435 | 27435 | const field_index = dest_ty.enumFieldIndex(string, mod) orelse { |
| 27436 | 27436 | const msg = msg: { |
| ... | ... | @@ -28544,7 +28544,7 @@ fn coerceVarArgParam( |
| 28544 | 28544 | .{}, |
| 28545 | 28545 | ), |
| 28546 | 28546 | .Fn => blk: { |
| 28547 | | const fn_val = try sema.resolveConstValue(block, .unneeded, inst, ""); |
| 28547 | const fn_val = try sema.resolveConstValue(block, LazySrcLoc.un(), inst, ""); |
| 28548 | 28548 | const fn_decl = fn_val.pointerDecl(mod).?; |
| 28549 | 28549 | break :blk try sema.analyzeDeclRef(fn_decl); |
| 28550 | 28550 | }, |
| ... | ... | @@ -34522,7 +34522,7 @@ fn semaStructFields(mod: *Module, struct_obj: *Module.Struct) CompileError!void |
| 34522 | 34522 | for (fields, 0..) |zir_field, field_i| { |
| 34523 | 34523 | const field_ty: Type = ty: { |
| 34524 | 34524 | if (zir_field.type_ref != .none) { |
| 34525 | | break :ty sema.resolveType(&block_scope, .unneeded, zir_field.type_ref) catch |err| switch (err) { |
| 34525 | break :ty sema.resolveType(&block_scope, LazySrcLoc.un(), zir_field.type_ref) catch |err| switch (err) { |
| 34526 | 34526 | error.NeededSourceLocation => { |
| 34527 | 34527 | const ty_src = mod.fieldSrcLoc(struct_obj.owner_decl, .{ |
| 34528 | 34528 | .index = field_i, |
| ... | ... | @@ -34538,7 +34538,7 @@ fn semaStructFields(mod: *Module, struct_obj: *Module.Struct) CompileError!void |
| 34538 | 34538 | const body = zir.extra[extra_index..][0..zir_field.type_body_len]; |
| 34539 | 34539 | extra_index += body.len; |
| 34540 | 34540 | const ty_ref = try sema.resolveBody(&block_scope, body, struct_obj.zir_index); |
| 34541 | | break :ty sema.analyzeAsType(&block_scope, .unneeded, ty_ref) catch |err| switch (err) { |
| 34541 | break :ty sema.analyzeAsType(&block_scope, LazySrcLoc.un(), ty_ref) catch |err| switch (err) { |
| 34542 | 34542 | error.NeededSourceLocation => { |
| 34543 | 34543 | const ty_src = mod.fieldSrcLoc(struct_obj.owner_decl, .{ |
| 34544 | 34544 | .index = field_i, |
| ... | ... | @@ -34621,7 +34621,7 @@ fn semaStructFields(mod: *Module, struct_obj: *Module.Struct) CompileError!void |
| 34621 | 34621 | const body = zir.extra[extra_index..][0..zir_field.align_body_len]; |
| 34622 | 34622 | extra_index += body.len; |
| 34623 | 34623 | const align_ref = try sema.resolveBody(&block_scope, body, struct_obj.zir_index); |
| 34624 | | field.abi_align = sema.analyzeAsAlign(&block_scope, .unneeded, align_ref) catch |err| switch (err) { |
| 34624 | field.abi_align = sema.analyzeAsAlign(&block_scope, LazySrcLoc.un(), align_ref) catch |err| switch (err) { |
| 34625 | 34625 | error.NeededSourceLocation => { |
| 34626 | 34626 | const align_src = mod.fieldSrcLoc(struct_obj.owner_decl, .{ |
| 34627 | 34627 | .index = field_i, |
| ... | ... | @@ -34649,7 +34649,7 @@ fn semaStructFields(mod: *Module, struct_obj: *Module.Struct) CompileError!void |
| 34649 | 34649 | extra_index += body.len; |
| 34650 | 34650 | const init = try sema.resolveBody(&block_scope, body, struct_obj.zir_index); |
| 34651 | 34651 | const field = &struct_obj.fields.values()[field_i]; |
| 34652 | | const coerced = sema.coerce(&block_scope, field.ty, init, .unneeded) catch |err| switch (err) { |
| 34652 | const coerced = sema.coerce(&block_scope, field.ty, init, LazySrcLoc.un()) catch |err| switch (err) { |
| 34653 | 34653 | error.NeededSourceLocation => { |
| 34654 | 34654 | const init_src = mod.fieldSrcLoc(struct_obj.owner_decl, .{ |
| 34655 | 34655 | .index = field_i, |
| ... | ... | @@ -34881,7 +34881,7 @@ fn semaUnionFields(mod: *Module, union_obj: *Module.Union) CompileError!void { |
| 34881 | 34881 | |
| 34882 | 34882 | if (enum_field_vals.capacity() > 0) { |
| 34883 | 34883 | const enum_tag_val = if (tag_ref != .none) blk: { |
| 34884 | | const val = sema.semaUnionFieldVal(&block_scope, .unneeded, int_tag_ty, tag_ref) catch |err| switch (err) { |
| 34884 | const val = sema.semaUnionFieldVal(&block_scope, LazySrcLoc.un(), int_tag_ty, tag_ref) catch |err| switch (err) { |
| 34885 | 34885 | error.NeededSourceLocation => { |
| 34886 | 34886 | const val_src = mod.fieldSrcLoc(union_obj.owner_decl, .{ |
| 34887 | 34887 | .index = field_i, |
| ... | ... | @@ -34929,7 +34929,7 @@ fn semaUnionFields(mod: *Module, union_obj: *Module.Union) CompileError!void { |
| 34929 | 34929 | else if (field_type_ref == .none) |
| 34930 | 34930 | Type.noreturn |
| 34931 | 34931 | else |
| 34932 | | sema.resolveType(&block_scope, .unneeded, field_type_ref) catch |err| switch (err) { |
| 34932 | sema.resolveType(&block_scope, LazySrcLoc.un(), field_type_ref) catch |err| switch (err) { |
| 34933 | 34933 | error.NeededSourceLocation => { |
| 34934 | 34934 | const ty_src = mod.fieldSrcLoc(union_obj.owner_decl, .{ |
| 34935 | 34935 | .index = field_i, |
| ... | ... | @@ -35038,7 +35038,7 @@ fn semaUnionFields(mod: *Module, union_obj: *Module.Union) CompileError!void { |
| 35038 | 35038 | }; |
| 35039 | 35039 | |
| 35040 | 35040 | if (align_ref != .none) { |
| 35041 | | gop.value_ptr.abi_align = sema.resolveAlign(&block_scope, .unneeded, align_ref) catch |err| switch (err) { |
| 35041 | gop.value_ptr.abi_align = sema.resolveAlign(&block_scope, LazySrcLoc.un(), align_ref) catch |err| switch (err) { |
| 35042 | 35042 | error.NeededSourceLocation => { |
| 35043 | 35043 | const align_src = mod.fieldSrcLoc(union_obj.owner_decl, .{ |
| 35044 | 35044 | .index = field_i, |