authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-05-05 18:35:08-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-06-10 20:42:28-07:00
log08e97639513f09e2797bd7afcdfdfecdad6c6fd8
tree7917c0dc5444809b0e6a2b5a364785f9f8710b85
parent80bf5af3458b25ae7375b548dc7f42150fbef3c8

stage2: add missing comptimeOnly logic for InternPool


1 files changed, 12 insertions(+), 5 deletions(-)

src/type.zig+12-5
......@@ -4076,11 +4076,18 @@ pub const Type = struct {
40764076 pub fn comptimeOnly(ty: Type, mod: *const Module) bool {
40774077 if (ty.ip_index != .none) return switch (mod.intern_pool.indexToKey(ty.ip_index)) {
40784078 .int_type => false,
4079 .ptr_type => @panic("TODO"),
4080 .array_type => |array_type| return array_type.child.toType().comptimeOnly(mod),
4081 .vector_type => |vector_type| return vector_type.child.toType().comptimeOnly(mod),
4082 .opt_type => @panic("TODO"),
4083 .error_union_type => @panic("TODO"),
4079 .ptr_type => |ptr_type| {
4080 const child_ty = ptr_type.elem_type.toType();
4081 if (child_ty.zigTypeTag(mod) == .Fn) {
4082 return false;
4083 } else {
4084 return child_ty.comptimeOnly(mod);
4085 }
4086 },
4087 .array_type => |array_type| array_type.child.toType().comptimeOnly(mod),
4088 .vector_type => |vector_type| vector_type.child.toType().comptimeOnly(mod),
4089 .opt_type => |child| child.toType().comptimeOnly(mod),
4090 .error_union_type => |error_union_type| error_union_type.payload_type.toType().comptimeOnly(mod),
40844091 .simple_type => |t| switch (t) {
40854092 .f16,
40864093 .f32,