authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-07-22 20:21:27-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-07-22 20:21:27-07:00
logc804abc7f6948a14e806104dd5ded6cabc5665be
tree88c1eddc872ff02e0e3d0ac0a2b93a0a66a602c1
parent012cbdb422fd4d89fe24d272a22f21376a4ab884

Sema: handle adhoc inferred error sets in helper functions

There were two missing places. Regressed in the #16318 branch. Found from compiling Bun. Unfortunately we do not have a behavior test reduction for this bug.

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

src/type.zig+2-1
...@@ -2065,7 +2065,7 @@ pub const Type = struct {...@@ -2065,7 +2065,7 @@ pub const Type = struct {
2065 pub fn errorSetIsEmpty(ty: Type, mod: *Module) bool {2065 pub fn errorSetIsEmpty(ty: Type, mod: *Module) bool {
2066 const ip = &mod.intern_pool;2066 const ip = &mod.intern_pool;
2067 return switch (ty.toIntern()) {2067 return switch (ty.toIntern()) {
2068 .anyerror_type => false,2068 .anyerror_type, .adhoc_inferred_error_set_type => false,
2069 else => switch (ip.indexToKey(ty.toIntern())) {2069 else => switch (ip.indexToKey(ty.toIntern())) {
2070 .error_set_type => |error_set_type| error_set_type.names.len == 0,2070 .error_set_type => |error_set_type| error_set_type.names.len == 0,
2071 .inferred_error_set_type => |i| switch (ip.funcIesResolved(i).*) {2071 .inferred_error_set_type => |i| switch (ip.funcIesResolved(i).*) {
...@@ -2084,6 +2084,7 @@ pub const Type = struct {...@@ -2084,6 +2084,7 @@ pub const Type = struct {
2084 const ip = &mod.intern_pool;2084 const ip = &mod.intern_pool;
2085 return switch (ty.toIntern()) {2085 return switch (ty.toIntern()) {
2086 .anyerror_type => true,2086 .anyerror_type => true,
2087 .adhoc_inferred_error_set_type => false,
2087 else => switch (mod.intern_pool.indexToKey(ty.toIntern())) {2088 else => switch (mod.intern_pool.indexToKey(ty.toIntern())) {
2088 .inferred_error_set_type => |i| ip.funcIesResolved(i).* == .anyerror_type,2089 .inferred_error_set_type => |i| ip.funcIesResolved(i).* == .anyerror_type,
2089 else => false,2090 else => false,