diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-07-13 00:40:16 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-07-18 19:02:06 -0700 |
| commit | 927f6ec8ca2234e8c4f27174359d5053da63a77d (patch) | |
| tree | 7e09d07b142f12e5ae4ff94ff48fa7e63ba96f87 /src/type.zig | |
| parent | 82db06fa673dabc640c4c954df0dee7a8a6d3bfc (diff) | |
| download | zig-927f6ec8ca2234e8c4f27174359d5053da63a77d.tar.gz zig-927f6ec8ca2234e8c4f27174359d5053da63a77d.zip | |
frontend: fix inferred error sets of comptime/inline calls
Previously, they shared function index with the owner decl, but that
would clobber the data stored for inferred error sets of runtime calls.
Now there is an adhoc_inferred_error_set_type which models the problem
much more correctly.
Diffstat (limited to 'src/type.zig')
| -rw-r--r-- | src/type.zig | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/type.zig b/src/type.zig index 8fcab8fcd0..ceb795a870 100644 --- a/src/type.zig +++ b/src/type.zig @@ -292,6 +292,7 @@ pub const Type = struct { .comptime_int, .comptime_float, .noreturn, + .adhoc_inferred_error_set, => return writer.writeAll(@tagName(s)), .null, @@ -533,6 +534,7 @@ pub const Type = struct { .c_longdouble, .bool, .anyerror, + .adhoc_inferred_error_set, .anyopaque, .atomic_order, .atomic_rmw_op, @@ -696,6 +698,7 @@ pub const Type = struct { => true, .anyerror, + .adhoc_inferred_error_set, .anyopaque, .atomic_order, .atomic_rmw_op, @@ -954,7 +957,9 @@ pub const Type = struct { }, // TODO revisit this when we have the concept of the error tag type - .anyerror => return AbiAlignmentAdvanced{ .scalar = 2 }, + .anyerror, + .adhoc_inferred_error_set, + => return AbiAlignmentAdvanced{ .scalar = 2 }, .void, .type, @@ -1418,7 +1423,9 @@ pub const Type = struct { => return AbiSizeAdvanced{ .scalar = 0 }, // TODO revisit this when we have the concept of the error tag type - .anyerror => return AbiSizeAdvanced{ .scalar = 2 }, + .anyerror, + .adhoc_inferred_error_set, + => return AbiSizeAdvanced{ .scalar = 2 }, .prefetch_options => unreachable, // missing call to resolveTypeFields .export_options => unreachable, // missing call to resolveTypeFields @@ -1661,7 +1668,9 @@ pub const Type = struct { .void => return 0, // TODO revisit this when we have the concept of the error tag type - .anyerror => return 16, + .anyerror, + .adhoc_inferred_error_set, + => return 16, .anyopaque => unreachable, .type => unreachable, @@ -2503,6 +2512,7 @@ pub const Type = struct { .export_options, .extern_options, .type_info, + .adhoc_inferred_error_set, => return null, .void => return Value.void, @@ -2697,6 +2707,7 @@ pub const Type = struct { .bool, .void, .anyerror, + .adhoc_inferred_error_set, .noreturn, .generic_poison, .atomic_order, |
