Merge pull request #17651 from Vexu/error-limit

Make distinct error limit configurable (attempt #2)
This commit is contained in:
Andrew Kelley
2023-10-23 03:19:03 -04:00
committed by GitHub
14 changed files with 195 additions and 110 deletions

View File

@@ -1054,6 +1054,7 @@ pub fn genTypedValue(
const payload_type = typed_value.ty.errorUnionPayload(mod);
if (!payload_type.hasRuntimeBitsIgnoreComptime(mod)) {
// We use the error type directly as the type.
const err_int_ty = try mod.errorIntType();
switch (mod.intern_pool.indexToKey(typed_value.val.toIntern()).error_union.val) {
.err_name => |err_name| return genTypedValue(bin_file, src_loc, .{
.ty = err_type,
@@ -1063,8 +1064,8 @@ pub fn genTypedValue(
} })).toValue(),
}, owner_decl_index),
.payload => return genTypedValue(bin_file, src_loc, .{
.ty = Type.err_int,
.val = try mod.intValue(Type.err_int, 0),
.ty = err_int_ty,
.val = try mod.intValue(err_int_ty, 0),
}, owner_decl_index),
}
}