authorgravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2026-10-20 00:53:04-07:00
committergravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2026-10-20 11:56:52-07:00
log0b737050465cfd9a9a497ffed60517d52fd2e0db
treea79f230d002f6cca9fc15e8e2c24c6c623fbd9af
parent6e053dbf04a224d5aa73dd976c994ec68dd5a7cf

Sema: include sentinel in allocated result of unflattenArray


1 files changed, 3 insertions(+), 4 deletions(-)

src/Sema/comptime_ptr_access.zig+3-4
......@@ -1031,13 +1031,12 @@ fn unflattenArray(
10311031 }
10321032
10331033 const elem_ty = ty.childType(zcu);
1034 const buf = try arena.alloc(InternPool.Index, @intCast(ty.arrayLen(zcu)));
1034 const buf = try arena.alloc(InternPool.Index, @intCast(ty.arrayLenIncludingSentinel(zcu)));
10351035 for (buf) |*elem| {
10361036 elem.* = (try unflattenArray(sema, elem_ty, elems, next_idx)).toIntern();
10371037 }
1038 if (ty.sentinel(zcu) != null) {
1039 // TODO: validate sentinel
1040 _ = try unflattenArray(sema, elem_ty, elems, next_idx);
1038 if (ty.sentinel(zcu)) |sent| {
1039 assert(sent.toIntern() == buf[buf.len - 1]);
10411040 }
10421041 return pt.aggregateValue(ty, buf);
10431042}