aboutsummaryrefslogtreecommitdiff
path: root/src/type.zig
diff options
context:
space:
mode:
authorJacob Young <jacobly0@users.noreply.github.com>2023-08-09 00:20:43 -0400
committerJacob Young <jacobly0@users.noreply.github.com>2023-08-09 05:46:44 -0400
commit66084b6c3f78349a7730c02614125185df8b6672 (patch)
tree3981c3c1d5f1fc036b468e2377be1a1bb14859bc /src/type.zig
parentcd7998096b624b326dddcbb2752fe4bcdac8df9f (diff)
downloadzig-66084b6c3f78349a7730c02614125185df8b6672.tar.gz
zig-66084b6c3f78349a7730c02614125185df8b6672.zip
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
Diffstat (limited to 'src/type.zig')
-rw-r--r--src/type.zig12
1 files changed, 6 insertions, 6 deletions
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),