From 66084b6c3f78349a7730c02614125185df8b6672 Mon Sep 17 00:00:00 2001 From: Jacob Young Date: Wed, 9 Aug 2023 00:20:43 -0400 Subject: Sema: remove `validateRunTimeType` This function does not seem to differ in any interesting way from `!typeRequiresComptime`, other than the `is_extern` param which is only used in one place, and some differences did not seem correct anyway. My reasoning for changing opaque types to be comptime-only is that `explainWhyTypeIsComptime` is quite happy to explain why they are. :D --- src/type.zig | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/type.zig') diff --git a/src/type.zig b/src/type.zig index d1d182714f..89c920fe7a 100644 --- a/src/type.zig +++ b/src/type.zig @@ -2664,10 +2664,10 @@ pub const Type = struct { .int_type => false, .ptr_type => |ptr_type| { const child_ty = ptr_type.child.toType(); - if (child_ty.zigTypeTag(mod) == .Fn) { - return false; - } else { - return child_ty.comptimeOnly(mod); + switch (child_ty.zigTypeTag(mod)) { + .Fn => return mod.typeToFunc(child_ty).?.is_generic, + .Opaque => return false, + else => return child_ty.comptimeOnly(mod), } }, .anyframe_type => |child| { @@ -2704,7 +2704,6 @@ pub const Type = struct { .c_longlong, .c_ulonglong, .c_longdouble, - .anyopaque, .bool, .void, .anyerror, @@ -2723,6 +2722,7 @@ pub const Type = struct { .extern_options, => false, + .anyopaque, .type, .comptime_int, .comptime_float, @@ -2769,7 +2769,7 @@ pub const Type = struct { } }, - .opaque_type => false, + .opaque_type => true, .enum_type => |enum_type| enum_type.tag_ty.toType().comptimeOnly(mod), -- cgit v1.2.3