aboutsummaryrefslogtreecommitdiff
path: root/src/value.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-07-17 17:47:59 -0700
committerAndrew Kelley <andrew@ziglang.org>2023-07-18 19:02:06 -0700
commit3f2a4720b1ef057215c8240b3a377c523ee63e94 (patch)
treeafd14ff8780da15e9b240dc2612d86083b49a81a /src/value.zig
parentb03d34429d059dc3f6056d7f780dc623c96523b4 (diff)
downloadzig-3f2a4720b1ef057215c8240b3a377c523ee63e94.tar.gz
zig-3f2a4720b1ef057215c8240b3a377c523ee63e94.zip
compiler: fix branch regressions
* getOwnedFunctionIndex no longer checks if the value is actually a function. * The callsites to `intern` that I added want to avoid the `getCoerced` call, so I added `intern2`. * Adding to inferred error sets should not happen if the destination error set is not the inferred error set of the current Sema instance. * adhoc_inferred_error_set_type can be seen by the backend. Treat it like anyerror.
Diffstat (limited to 'src/value.zig')
-rw-r--r--src/value.zig5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/value.zig b/src/value.zig
index f1371e9689..ec0f359671 100644
--- a/src/value.zig
+++ b/src/value.zig
@@ -262,6 +262,11 @@ pub const Value = struct {
return ip.getOrPutTrailingString(gpa, len);
}
+ pub fn intern2(val: Value, ty: Type, mod: *Module) Allocator.Error!InternPool.Index {
+ if (val.ip_index != .none) return val.ip_index;
+ return intern(val, ty, mod);
+ }
+
pub fn intern(val: Value, ty: Type, mod: *Module) Allocator.Error!InternPool.Index {
if (val.ip_index != .none) return (try mod.getCoerced(val, ty)).toIntern();
switch (val.tag()) {