aboutsummaryrefslogtreecommitdiff
path: root/src/InternPool.zig
diff options
context:
space:
mode:
authorJustus Klausecker <justus@klausecker.de>2025-08-07 13:02:01 +0200
committerJustus Klausecker <justus@klausecker.de>2025-08-12 16:33:57 +0200
commit05762ca02ff97e7abfe1b52c090663dbf99bd4fc (patch)
tree73e60e53611da67db0dd73cbde39aa93d94f44cf /src/InternPool.zig
parent0ef26d113ae5a8b307a3af76db61706846fea22f (diff)
downloadzig-05762ca02ff97e7abfe1b52c090663dbf99bd4fc.tar.gz
zig-05762ca02ff97e7abfe1b52c090663dbf99bd4fc.zip
address most comments
Diffstat (limited to 'src/InternPool.zig')
-rw-r--r--src/InternPool.zig8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/InternPool.zig b/src/InternPool.zig
index 65b7b52180..0aa664d611 100644
--- a/src/InternPool.zig
+++ b/src/InternPool.zig
@@ -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,
};