address most comments

This commit is contained in:
Justus Klausecker
2025-08-07 13:02:01 +02:00
parent 0ef26d113a
commit 05762ca02f
6 changed files with 61 additions and 99 deletions

View File

@@ -2036,6 +2036,8 @@ pub const Key = union(enum) {
/// Each element/field stored as an `Index`.
/// In the case of sentinel-terminated arrays, the sentinel value *is* stored,
/// so the slice length will be one more than the type's array length.
/// There must be at least one element which is not `undefined`. If all elements are
/// undefined, instead create an undefined value of the aggregate type.
aggregate: Aggregate,
/// An instance of a union.
un: Union,
@@ -8408,7 +8410,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, tid: Zcu.PerThread.Id, key: Key) All
if (!ip.isUndef(elem)) any_defined = true;
assert(ip.typeOf(elem) == child);
}
assert(any_defined);
assert(any_defined); // aggregate fields must not be all undefined
},
.struct_type => {
var any_defined = false;
@@ -8416,7 +8418,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, tid: Zcu.PerThread.Id, key: Key) All
if (!ip.isUndef(elem)) any_defined = true;
assert(ip.typeOf(elem) == field_ty);
}
assert(any_defined);
assert(any_defined); // aggregate fields must not be all undefined
},
.tuple_type => |tuple_type| {
var any_defined = false;
@@ -8424,7 +8426,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, tid: Zcu.PerThread.Id, key: Key) All
if (!ip.isUndef(elem)) any_defined = true;
assert(ip.typeOf(elem) == ty);
}
assert(any_defined);
assert(any_defined); // aggregate fields must not be all undefined
},
else => unreachable,
};