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(...@@ -1031,13 +1031,12 @@ fn unflattenArray(
1031 }1031 }
10321032
1033 const elem_ty = ty.childType(zcu);1033 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)));
1035 for (buf) |*elem| {1035 for (buf) |*elem| {
1036 elem.* = (try unflattenArray(sema, elem_ty, elems, next_idx)).toIntern();1036 elem.* = (try unflattenArray(sema, elem_ty, elems, next_idx)).toIntern();
1037 }1037 }
1038 if (ty.sentinel(zcu) != null) {1038 if (ty.sentinel(zcu)) |sent| {
1039 // TODO: validate sentinel1039 assert(sent.toIntern() == buf[buf.len - 1]);
1040 _ = try unflattenArray(sema, elem_ty, elems, next_idx);
1041 }1040 }
1042 return pt.aggregateValue(ty, buf);1041 return pt.aggregateValue(ty, buf);
1043}1042}