authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-05-30 21:37:36-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-06-10 20:47:57-07:00
log1430ac2fbba9c8077b9b164b97010c1bac195ed7
tree1e95b66d176768542e72589962b97f9143225280
parent91fb45a51b3fe29772c71cc353aaf1e07caeb507

Type: fix `@sizeOf(?anyerror)`


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

src/type.zig+2-5
......@@ -1886,11 +1886,8 @@ pub const Type = struct {
18861886 /// See also `isPtrLikeOptional`.
18871887 pub fn optionalReprIsPayload(ty: Type, mod: *const Module) bool {
18881888 return switch (mod.intern_pool.indexToKey(ty.toIntern())) {
1889 .opt_type => |child_type| switch (mod.intern_pool.indexToKey(child_type)) {
1890 .ptr_type => |ptr_type| switch (ptr_type.flags.size) {
1891 .C => false,
1892 .Slice, .Many, .One => !ptr_type.flags.is_allowzero,
1893 },
1889 .opt_type => |child_type| child_type == .anyerror_type or switch (mod.intern_pool.indexToKey(child_type)) {
1890 .ptr_type => |ptr_type| ptr_type.flags.size != .C and !ptr_type.flags.is_allowzero,
18941891 .error_set_type => true,
18951892 else => false,
18961893 },