authorchloe caruso <git@paperclover.net> 2024-07-27 05:51:20-07:00
committerchloe caruso <git@paperclover.net> 2024-07-27 22:15:51-07:00
log32094db88e8e631da9d39a171d589196a4d0d4d1
tree3a21296fd702e89584242347414c1b788fd45c90
parent69b6f056bfef5e63452f667d9a3a8604872f2a0b

fix: crash when analyzing an empty array without a result type


2 files changed, 5 insertions(+), 0 deletions(-)

CHANGELOG.md+1
...@@ -2,6 +2,7 @@...@@ -2,6 +2,7 @@
22
3- fix: crash when printing unused struct declaration error3- fix: crash when printing unused struct declaration error
4- fix: provide array result type to sema4- fix: provide array result type to sema
5- fix: crash when analyzing an empty array without a result type
56
6## 0.1.57## 0.1.5
78
src/core/Transform.zig+4
...@@ -1391,6 +1391,10 @@ fn transformExpression(...@@ -1391,6 +1391,10 @@ fn transformExpression(
1391 array_init.slice(&t.ast),1391 array_init.slice(&t.ast),
1392 ) orelse return null;1392 ) orelse return null;
13931393
1394 if (array_type == null and items.len == 0) {
1395 return .empty_array;
1396 }
1397
1394 return try t.addRef(.array_init, .{1398 return try t.addRef(.array_init, .{
1395 .src_node = ctx.nodeOffset(node),1399 .src_node = ctx.nodeOffset(node),
1396 .extra_index = try t.extra.append(t.gpa, Teg.ArrayInit, .{1400 .extra_index = try t.extra.append(t.gpa, Teg.ArrayInit, .{