authorgravatar for me@paperdave.netdave caruso <me@paperdave.net> 2024-07-27 05:51:20-07:00
committergravatar for me@paperdave.netdave caruso <me@paperdave.net> 2024-07-27 22:15:51-07:00
logd1721f8bb4b8915d687ef22bca9d34c7fdd13334
tree3a21296fd702e89584242347414c1b788fd45c90
parent28d59decc157620157d0c1678600670becf50c73
signature Commit is signed but in an unrecognized format.

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, .{