authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-09-02 19:49:11+03:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-09-02 19:49:11+03:00
log6aee07c1446f3ce98d326998c887fbca3b7fd945
treeba0dbe68453d8ac431c9ba7aabd4f2cd40a18a56
parentf281f3d10e4eaedc7c68afc4fcbbfd35e1f29a0f

Sema: remove unused src param from typeRequiresComptime


3 files changed, 35 insertions(+), 35 deletions(-)

src/Module.zig+1-1
...@@ -4635,7 +4635,7 @@ fn semaDecl(mod: *Module, decl_index: Decl.Index) !bool {...@@ -4635,7 +4635,7 @@ fn semaDecl(mod: *Module, decl_index: Decl.Index) !bool {
4635 decl.analysis = .complete;4635 decl.analysis = .complete;
4636 decl.generation = mod.generation;4636 decl.generation = mod.generation;
46374637
4638 const has_runtime_bits = try sema.fnHasRuntimeBits(&block_scope, ty_src, decl.ty);4638 const has_runtime_bits = try sema.fnHasRuntimeBits(decl.ty);
46394639
4640 if (has_runtime_bits) {4640 if (has_runtime_bits) {
4641 // We don't fully codegen the decl until later, but we do need to reserve a global4641 // We don't fully codegen the decl until later, but we do need to reserve a global
src/Sema.zig+32-32
...@@ -2865,7 +2865,7 @@ fn zirRetPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air....@@ -2865,7 +2865,7 @@ fn zirRetPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.
2865 const inst_data = sema.code.instructions.items(.data)[inst].node;2865 const inst_data = sema.code.instructions.items(.data)[inst].node;
2866 const src = LazySrcLoc.nodeOffset(inst_data);2866 const src = LazySrcLoc.nodeOffset(inst_data);
28672867
2868 if (block.is_comptime or try sema.typeRequiresComptime(block, src, sema.fn_ret_ty)) {2868 if (block.is_comptime or try sema.typeRequiresComptime(sema.fn_ret_ty)) {
2869 const fn_ret_ty = try sema.resolveTypeFields(block, src, sema.fn_ret_ty);2869 const fn_ret_ty = try sema.resolveTypeFields(block, src, sema.fn_ret_ty);
2870 return sema.analyzeComptimeAlloc(block, fn_ret_ty, 0, src);2870 return sema.analyzeComptimeAlloc(block, fn_ret_ty, 0, src);
2871 }2871 }
...@@ -5788,7 +5788,7 @@ fn analyzeCall(...@@ -5788,7 +5788,7 @@ fn analyzeCall(
5788 var is_comptime_call = block.is_comptime or modifier == .compile_time;5788 var is_comptime_call = block.is_comptime or modifier == .compile_time;
5789 var comptime_only_ret_ty = false;5789 var comptime_only_ret_ty = false;
5790 if (!is_comptime_call) {5790 if (!is_comptime_call) {
5791 if (sema.typeRequiresComptime(block, func_src, func_ty_info.return_type)) |ct| {5791 if (sema.typeRequiresComptime(func_ty_info.return_type)) |ct| {
5792 is_comptime_call = ct;5792 is_comptime_call = ct;
5793 comptime_only_ret_ty = ct;5793 comptime_only_ret_ty = ct;
5794 } else |err| switch (err) {5794 } else |err| switch (err) {
...@@ -6226,7 +6226,7 @@ fn analyzeInlineCallArg(...@@ -6226,7 +6226,7 @@ fn analyzeInlineCallArg(
6226 const param_ty = try sema.analyzeAsType(param_block, param_src, param_ty_inst);6226 const param_ty = try sema.analyzeAsType(param_block, param_src, param_ty_inst);
6227 new_fn_info.param_types[arg_i.*] = param_ty;6227 new_fn_info.param_types[arg_i.*] = param_ty;
6228 const uncasted_arg = uncasted_args[arg_i.*];6228 const uncasted_arg = uncasted_args[arg_i.*];
6229 if (try sema.typeRequiresComptime(arg_block, arg_src, param_ty)) {6229 if (try sema.typeRequiresComptime(param_ty)) {
6230 _ = sema.resolveConstMaybeUndefVal(arg_block, arg_src, uncasted_arg, "argument to parameter with comptime only type must be comptime known") catch |err| {6230 _ = sema.resolveConstMaybeUndefVal(arg_block, arg_src, uncasted_arg, "argument to parameter with comptime only type must be comptime known") catch |err| {
6231 if (err == error.AnalysisFail and sema.err != null) {6231 if (err == error.AnalysisFail and sema.err != null) {
6232 try sema.addComptimeReturnTypeNote(arg_block, func, func_src, ret_ty, sema.err.?, comptime_only_ret_ty);6232 try sema.addComptimeReturnTypeNote(arg_block, func, func_src, ret_ty, sema.err.?, comptime_only_ret_ty);
...@@ -6328,7 +6328,7 @@ fn analyzeGenericCallArg(...@@ -6328,7 +6328,7 @@ fn analyzeGenericCallArg(
6328) !void {6328) !void {
6329 const is_runtime = comptime_arg.val.tag() == .generic_poison and6329 const is_runtime = comptime_arg.val.tag() == .generic_poison and
6330 comptime_arg.ty.hasRuntimeBits() and6330 comptime_arg.ty.hasRuntimeBits() and
6331 !(try sema.typeRequiresComptime(block, arg_src, comptime_arg.ty));6331 !(try sema.typeRequiresComptime(comptime_arg.ty));
6332 if (is_runtime) {6332 if (is_runtime) {
6333 const param_ty = new_fn_info.param_types[runtime_i.*];6333 const param_ty = new_fn_info.param_types[runtime_i.*];
6334 const casted_arg = try sema.coerce(block, param_ty, uncasted_arg, arg_src);6334 const casted_arg = try sema.coerce(block, param_ty, uncasted_arg, arg_src);
...@@ -6593,7 +6593,7 @@ fn instantiateGenericCall(...@@ -6593,7 +6593,7 @@ fn instantiateGenericCall(
6593 }6593 }
6594 } else if (is_anytype) {6594 } else if (is_anytype) {
6595 const arg_ty = sema.typeOf(arg);6595 const arg_ty = sema.typeOf(arg);
6596 if (try sema.typeRequiresComptime(block, .unneeded, arg_ty)) {6596 if (try sema.typeRequiresComptime(arg_ty)) {
6597 const arg_val = try sema.resolveConstValue(block, .unneeded, arg, undefined);6597 const arg_val = try sema.resolveConstValue(block, .unneeded, arg, undefined);
6598 const child_arg = try child_sema.addConstant(arg_ty, arg_val);6598 const child_arg = try child_sema.addConstant(arg_ty, arg_val);
6599 child_sema.inst_map.putAssumeCapacityNoClobber(inst, child_arg);6599 child_sema.inst_map.putAssumeCapacityNoClobber(inst, child_arg);
...@@ -6646,7 +6646,7 @@ fn instantiateGenericCall(...@@ -6646,7 +6646,7 @@ fn instantiateGenericCall(
6646 const arg = child_sema.inst_map.get(inst).?;6646 const arg = child_sema.inst_map.get(inst).?;
6647 const copied_arg_ty = try child_sema.typeOf(arg).copy(new_decl_arena_allocator);6647 const copied_arg_ty = try child_sema.typeOf(arg).copy(new_decl_arena_allocator);
66486648
6649 if (try sema.typeRequiresComptime(block, .unneeded, copied_arg_ty)) {6649 if (try sema.typeRequiresComptime(copied_arg_ty)) {
6650 is_comptime = true;6650 is_comptime = true;
6651 }6651 }
66526652
...@@ -6677,7 +6677,7 @@ fn instantiateGenericCall(...@@ -6677,7 +6677,7 @@ fn instantiateGenericCall(
6677 // If the call evaluated to a return type that requires comptime, never mind6677 // If the call evaluated to a return type that requires comptime, never mind
6678 // our generic instantiation. Instead we need to perform a comptime call.6678 // our generic instantiation. Instead we need to perform a comptime call.
6679 const new_fn_info = new_decl.ty.fnInfo();6679 const new_fn_info = new_decl.ty.fnInfo();
6680 if (try sema.typeRequiresComptime(block, call_src, new_fn_info.return_type)) {6680 if (try sema.typeRequiresComptime(new_fn_info.return_type)) {
6681 return error.ComptimeReturn;6681 return error.ComptimeReturn;
6682 }6682 }
6683 // Similarly, if the call evaluated to a generic type we need to instead6683 // Similarly, if the call evaluated to a generic type we need to instead
...@@ -7858,7 +7858,7 @@ fn funcCommon(...@@ -7858,7 +7858,7 @@ fn funcCommon(
7858 }7858 }
78597859
7860 var ret_ty_requires_comptime = false;7860 var ret_ty_requires_comptime = false;
7861 const ret_poison = if (sema.typeRequiresComptime(block, ret_ty_src, bare_return_type)) |ret_comptime| rp: {7861 const ret_poison = if (sema.typeRequiresComptime(bare_return_type)) |ret_comptime| rp: {
7862 ret_ty_requires_comptime = ret_comptime;7862 ret_ty_requires_comptime = ret_comptime;
7863 break :rp bare_return_type.tag() == .generic_poison;7863 break :rp bare_return_type.tag() == .generic_poison;
7864 } else |err| switch (err) {7864 } else |err| switch (err) {
...@@ -8092,7 +8092,7 @@ fn analyzeParameter(...@@ -8092,7 +8092,7 @@ fn analyzeParameter(
8092 cc: std.builtin.CallingConvention,8092 cc: std.builtin.CallingConvention,
8093 has_body: bool,8093 has_body: bool,
8094) !void {8094) !void {
8095 const requires_comptime = try sema.typeRequiresComptime(block, param_src, param.ty);8095 const requires_comptime = try sema.typeRequiresComptime(param.ty);
8096 comptime_params[i] = param.is_comptime or requires_comptime;8096 comptime_params[i] = param.is_comptime or requires_comptime;
8097 const this_generic = param.ty.tag() == .generic_poison;8097 const this_generic = param.ty.tag() == .generic_poison;
8098 is_generic.* = is_generic.* or this_generic;8098 is_generic.* = is_generic.* or this_generic;
...@@ -8197,7 +8197,7 @@ fn zirParam(...@@ -8197,7 +8197,7 @@ fn zirParam(
8197 }8197 }
8198 };8198 };
8199 const is_comptime = comptime_syntax or8199 const is_comptime = comptime_syntax or
8200 try sema.typeRequiresComptime(block, src, param_ty);8200 try sema.typeRequiresComptime(param_ty);
8201 if (sema.inst_map.get(inst)) |arg| {8201 if (sema.inst_map.get(inst)) |arg| {
8202 if (is_comptime) {8202 if (is_comptime) {
8203 // We have a comptime value for this parameter so it should be elided from the8203 // We have a comptime value for this parameter so it should be elided from the
...@@ -8257,7 +8257,7 @@ fn zirParamAnytype(...@@ -8257,7 +8257,7 @@ fn zirParamAnytype(
82578257
8258 if (sema.inst_map.get(inst)) |air_ref| {8258 if (sema.inst_map.get(inst)) |air_ref| {
8259 const param_ty = sema.typeOf(air_ref);8259 const param_ty = sema.typeOf(air_ref);
8260 if (comptime_syntax or try sema.typeRequiresComptime(block, src, param_ty)) {8260 if (comptime_syntax or try sema.typeRequiresComptime(param_ty)) {
8261 // We have a comptime value for this parameter so it should be elided from the8261 // We have a comptime value for this parameter so it should be elided from the
8262 // function type of the function instruction in this block.8262 // function type of the function instruction in this block.
8263 return;8263 return;
...@@ -20368,7 +20368,7 @@ fn validateRunTimeType(...@@ -20368,7 +20368,7 @@ fn validateRunTimeType(
20368 .Void,20368 .Void,
20369 => return true,20369 => return true,
2037020370
20371 .Enum => return !(try sema.typeRequiresComptime(block, src, ty)),20371 .Enum => return !(try sema.typeRequiresComptime(ty)),
2037220372
20373 .BoundFn,20373 .BoundFn,
20374 .ComptimeFloat,20374 .ComptimeFloat,
...@@ -20402,7 +20402,7 @@ fn validateRunTimeType(...@@ -20402,7 +20402,7 @@ fn validateRunTimeType(
2040220402
20403 .Struct, .Union => {20403 .Struct, .Union => {
20404 const resolved_ty = try sema.resolveTypeFields(block, src, ty);20404 const resolved_ty = try sema.resolveTypeFields(block, src, ty);
20405 const needs_comptime = try sema.typeRequiresComptime(block, src, resolved_ty);20405 const needs_comptime = try sema.typeRequiresComptime(resolved_ty);
20406 return !needs_comptime;20406 return !needs_comptime;
20407 },20407 },
20408 };20408 };
...@@ -20510,7 +20510,7 @@ fn explainWhyTypeIsComptimeInner(...@@ -20510,7 +20510,7 @@ fn explainWhyTypeIsComptimeInner(
20510 .range = .type,20510 .range = .type,
20511 });20511 });
2051220512
20513 if (try sema.typeRequiresComptime(block, src, field.ty)) {20513 if (try sema.typeRequiresComptime(field.ty)) {
20514 try mod.errNoteNonLazy(field_src_loc, msg, "struct requires comptime because of this field", .{});20514 try mod.errNoteNonLazy(field_src_loc, msg, "struct requires comptime because of this field", .{});
20515 try sema.explainWhyTypeIsComptimeInner(block, src, msg, field_src_loc, field.ty, type_set);20515 try sema.explainWhyTypeIsComptimeInner(block, src, msg, field_src_loc, field.ty, type_set);
20516 }20516 }
...@@ -20530,7 +20530,7 @@ fn explainWhyTypeIsComptimeInner(...@@ -20530,7 +20530,7 @@ fn explainWhyTypeIsComptimeInner(
20530 .range = .type,20530 .range = .type,
20531 });20531 });
2053220532
20533 if (try sema.typeRequiresComptime(block, src, field.ty)) {20533 if (try sema.typeRequiresComptime(field.ty)) {
20534 try mod.errNoteNonLazy(field_src_loc, msg, "union requires comptime because of this field", .{});20534 try mod.errNoteNonLazy(field_src_loc, msg, "union requires comptime because of this field", .{});
20535 try sema.explainWhyTypeIsComptimeInner(block, src, msg, field_src_loc, field.ty, type_set);20535 try sema.explainWhyTypeIsComptimeInner(block, src, msg, field_src_loc, field.ty, type_set);
20536 }20536 }
...@@ -27627,7 +27627,7 @@ pub fn resolveTypeLayout(...@@ -27627,7 +27627,7 @@ pub fn resolveTypeLayout(
27627 // In case of querying the ABI alignment of this optional, we will ask27627 // In case of querying the ABI alignment of this optional, we will ask
27628 // for hasRuntimeBits() of the payload type, so we need "requires comptime"27628 // for hasRuntimeBits() of the payload type, so we need "requires comptime"
27629 // to be known already before this function returns.27629 // to be known already before this function returns.
27630 _ = try sema.typeRequiresComptime(block, src, payload_ty);27630 _ = try sema.typeRequiresComptime(payload_ty);
27631 return sema.resolveTypeLayout(block, src, payload_ty);27631 return sema.resolveTypeLayout(block, src, payload_ty);
27632 },27632 },
27633 .ErrorUnion => {27633 .ErrorUnion => {
...@@ -27682,7 +27682,7 @@ fn resolveStructLayout(...@@ -27682,7 +27682,7 @@ fn resolveStructLayout(
27682 // for hasRuntimeBits() of each field, so we need "requires comptime"27682 // for hasRuntimeBits() of each field, so we need "requires comptime"
27683 // to be known already before this function returns.27683 // to be known already before this function returns.
27684 for (struct_obj.fields.values()) |field, i| {27684 for (struct_obj.fields.values()) |field, i| {
27685 _ = sema.typeRequiresComptime(block, src, field.ty) catch |err| switch (err) {27685 _ = sema.typeRequiresComptime(field.ty) catch |err| switch (err) {
27686 error.AnalysisFail => {27686 error.AnalysisFail => {
27687 const msg = sema.err orelse return err;27687 const msg = sema.err orelse return err;
27688 try sema.addFieldErrNote(block, ty, i, msg, "while checking this field", .{});27688 try sema.addFieldErrNote(block, ty, i, msg, "while checking this field", .{});
...@@ -27914,7 +27914,7 @@ fn resolveStructFully(...@@ -27914,7 +27914,7 @@ fn resolveStructFully(
27914 }27914 }
2791527915
27916 // And let's not forget comptime-only status.27916 // And let's not forget comptime-only status.
27917 _ = try sema.typeRequiresComptime(block, src, ty);27917 _ = try sema.typeRequiresComptime(ty);
27918}27918}
2791927919
27920fn resolveUnionFully(27920fn resolveUnionFully(
...@@ -27947,7 +27947,7 @@ fn resolveUnionFully(...@@ -27947,7 +27947,7 @@ fn resolveUnionFully(
27947 }27947 }
2794827948
27949 // And let's not forget comptime-only status.27949 // And let's not forget comptime-only status.
27950 _ = try sema.typeRequiresComptime(block, src, ty);27950 _ = try sema.typeRequiresComptime(ty);
27951}27951}
2795227952
27953pub fn resolveTypeFields(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type) CompileError!Type {27953pub fn resolveTypeFields(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type) CompileError!Type {
...@@ -29582,7 +29582,7 @@ fn typePtrOrOptionalPtrTy(...@@ -29582,7 +29582,7 @@ fn typePtrOrOptionalPtrTy(
29582/// TODO assert the return value matches `ty.comptimeOnly`29582/// TODO assert the return value matches `ty.comptimeOnly`
29583/// TODO merge these implementations together with the "advanced"/sema_kit pattern seen29583/// TODO merge these implementations together with the "advanced"/sema_kit pattern seen
29584/// elsewhere in value.zig29584/// elsewhere in value.zig
29585pub fn typeRequiresComptime(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type) CompileError!bool {29585pub fn typeRequiresComptime(sema: *Sema, ty: Type) CompileError!bool {
29586 return switch (ty.tag()) {29586 return switch (ty.tag()) {
29587 .u1,29587 .u1,
29588 .u8,29588 .u8,
...@@ -29673,7 +29673,7 @@ pub fn typeRequiresComptime(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Typ...@@ -29673,7 +29673,7 @@ pub fn typeRequiresComptime(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Typ
29673 .array,29673 .array,
29674 .array_sentinel,29674 .array_sentinel,
29675 .vector,29675 .vector,
29676 => return sema.typeRequiresComptime(block, src, ty.childType()),29676 => return sema.typeRequiresComptime(ty.childType()),
2967729677
29678 .pointer,29678 .pointer,
29679 .single_const_pointer,29679 .single_const_pointer,
...@@ -29689,7 +29689,7 @@ pub fn typeRequiresComptime(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Typ...@@ -29689,7 +29689,7 @@ pub fn typeRequiresComptime(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Typ
29689 if (child_ty.zigTypeTag() == .Fn) {29689 if (child_ty.zigTypeTag() == .Fn) {
29690 return child_ty.fnInfo().is_generic;29690 return child_ty.fnInfo().is_generic;
29691 } else {29691 } else {
29692 return sema.typeRequiresComptime(block, src, child_ty);29692 return sema.typeRequiresComptime(child_ty);
29693 }29693 }
29694 },29694 },
2969529695
...@@ -29698,14 +29698,14 @@ pub fn typeRequiresComptime(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Typ...@@ -29698,14 +29698,14 @@ pub fn typeRequiresComptime(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Typ
29698 .optional_single_const_pointer,29698 .optional_single_const_pointer,
29699 => {29699 => {
29700 var buf: Type.Payload.ElemType = undefined;29700 var buf: Type.Payload.ElemType = undefined;
29701 return sema.typeRequiresComptime(block, src, ty.optionalChild(&buf));29701 return sema.typeRequiresComptime(ty.optionalChild(&buf));
29702 },29702 },
2970329703
29704 .tuple, .anon_struct => {29704 .tuple, .anon_struct => {
29705 const tuple = ty.tupleFields();29705 const tuple = ty.tupleFields();
29706 for (tuple.types) |field_ty, i| {29706 for (tuple.types) |field_ty, i| {
29707 const have_comptime_val = tuple.values[i].tag() != .unreachable_value;29707 const have_comptime_val = tuple.values[i].tag() != .unreachable_value;
29708 if (!have_comptime_val and try sema.typeRequiresComptime(block, src, field_ty)) {29708 if (!have_comptime_val and try sema.typeRequiresComptime(field_ty)) {
29709 return true;29709 return true;
29710 }29710 }
29711 }29711 }
...@@ -29726,7 +29726,7 @@ pub fn typeRequiresComptime(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Typ...@@ -29726,7 +29726,7 @@ pub fn typeRequiresComptime(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Typ
29726 struct_obj.requires_comptime = .wip;29726 struct_obj.requires_comptime = .wip;
29727 for (struct_obj.fields.values()) |field| {29727 for (struct_obj.fields.values()) |field| {
29728 if (field.is_comptime) continue;29728 if (field.is_comptime) continue;
29729 if (try sema.typeRequiresComptime(block, src, field.ty)) {29729 if (try sema.typeRequiresComptime(field.ty)) {
29730 struct_obj.requires_comptime = .yes;29730 struct_obj.requires_comptime = .yes;
29731 return true;29731 return true;
29732 }29732 }
...@@ -29750,7 +29750,7 @@ pub fn typeRequiresComptime(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Typ...@@ -29750,7 +29750,7 @@ pub fn typeRequiresComptime(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Typ
2975029750
29751 union_obj.requires_comptime = .wip;29751 union_obj.requires_comptime = .wip;
29752 for (union_obj.fields.values()) |field| {29752 for (union_obj.fields.values()) |field| {
29753 if (try sema.typeRequiresComptime(block, src, field.ty)) {29753 if (try sema.typeRequiresComptime(field.ty)) {
29754 union_obj.requires_comptime = .yes;29754 union_obj.requires_comptime = .yes;
29755 return true;29755 return true;
29756 }29756 }
...@@ -29761,18 +29761,18 @@ pub fn typeRequiresComptime(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Typ...@@ -29761,18 +29761,18 @@ pub fn typeRequiresComptime(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Typ
29761 }29761 }
29762 },29762 },
2976329763
29764 .error_union => return sema.typeRequiresComptime(block, src, ty.errorUnionPayload()),29764 .error_union => return sema.typeRequiresComptime(ty.errorUnionPayload()),
29765 .anyframe_T => {29765 .anyframe_T => {
29766 const child_ty = ty.castTag(.anyframe_T).?.data;29766 const child_ty = ty.castTag(.anyframe_T).?.data;
29767 return sema.typeRequiresComptime(block, src, child_ty);29767 return sema.typeRequiresComptime(child_ty);
29768 },29768 },
29769 .enum_numbered => {29769 .enum_numbered => {
29770 const tag_ty = ty.castTag(.enum_numbered).?.data.tag_ty;29770 const tag_ty = ty.castTag(.enum_numbered).?.data.tag_ty;
29771 return sema.typeRequiresComptime(block, src, tag_ty);29771 return sema.typeRequiresComptime(tag_ty);
29772 },29772 },
29773 .enum_full, .enum_nonexhaustive => {29773 .enum_full, .enum_nonexhaustive => {
29774 const tag_ty = ty.cast(Type.Payload.EnumFull).?.data.tag_ty;29774 const tag_ty = ty.cast(Type.Payload.EnumFull).?.data.tag_ty;
29775 return sema.typeRequiresComptime(block, src, tag_ty);29775 return sema.typeRequiresComptime(tag_ty);
29776 },29776 },
29777 };29777 };
29778}29778}
...@@ -29810,7 +29810,7 @@ fn unionFieldAlignment(...@@ -29810,7 +29810,7 @@ fn unionFieldAlignment(
29810}29810}
2981129811
29812/// Synchronize logic with `Type.isFnOrHasRuntimeBits`.29812/// Synchronize logic with `Type.isFnOrHasRuntimeBits`.
29813pub fn fnHasRuntimeBits(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type) CompileError!bool {29813pub fn fnHasRuntimeBits(sema: *Sema, ty: Type) CompileError!bool {
29814 const fn_info = ty.fnInfo();29814 const fn_info = ty.fnInfo();
29815 if (fn_info.is_generic) return false;29815 if (fn_info.is_generic) return false;
29816 if (fn_info.is_var_args) return true;29816 if (fn_info.is_var_args) return true;
...@@ -29819,7 +29819,7 @@ pub fn fnHasRuntimeBits(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type) C...@@ -29819,7 +29819,7 @@ pub fn fnHasRuntimeBits(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type) C
29819 .Inline => return false,29819 .Inline => return false,
29820 else => {},29820 else => {},
29821 }29821 }
29822 if (try sema.typeRequiresComptime(block, src, fn_info.return_type)) {29822 if (try sema.typeRequiresComptime(fn_info.return_type)) {
29823 return false;29823 return false;
29824 }29824 }
29825 return true;29825 return true;
src/type.zig+2-2
...@@ -2401,7 +2401,7 @@ pub const Type = extern union {...@@ -2401,7 +2401,7 @@ pub const Type = extern union {
2401 } else if (ty.childType().zigTypeTag() == .Fn) {2401 } else if (ty.childType().zigTypeTag() == .Fn) {
2402 return !ty.childType().fnInfo().is_generic;2402 return !ty.childType().fnInfo().is_generic;
2403 } else if (sema_kit) |sk| {2403 } else if (sema_kit) |sk| {
2404 return !(try sk.sema.typeRequiresComptime(sk.block, sk.src, ty));2404 return !(try sk.sema.typeRequiresComptime(ty));
2405 } else {2405 } else {
2406 return !comptimeOnly(ty);2406 return !comptimeOnly(ty);
2407 }2407 }
...@@ -2440,7 +2440,7 @@ pub const Type = extern union {...@@ -2440,7 +2440,7 @@ pub const Type = extern union {
2440 if (ignore_comptime_only) {2440 if (ignore_comptime_only) {
2441 return true;2441 return true;
2442 } else if (sema_kit) |sk| {2442 } else if (sema_kit) |sk| {
2443 return !(try sk.sema.typeRequiresComptime(sk.block, sk.src, child_ty));2443 return !(try sk.sema.typeRequiresComptime(child_ty));
2444 } else {2444 } else {
2445 return !comptimeOnly(child_ty);2445 return !comptimeOnly(child_ty);
2446 }2446 }