astgen: assign_destructure, u0 int type, slice_length optimization

- Implement assignDestructure() and assignDestructureMaybeDecls() with
  RL_DESTRUCTURE result location, DestructureComponent types, rvalue
  handling for validate_destructure/elem_val_imm/store_node, and array
  init optimization.
- Fix tryResolvePrimitiveIdent to allow bit_count==0 (u0/i0 types) and
  reject leading zeros (u01, i007).
- Add nodeIsTriviallyZero and slice_length optimization for
  arr[start..][0..len] patterns in AST_NODE_SLICE and
  AST_NODE_SLICE_SENTINEL cases.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-14 14:04:06 +00:00
parent 84c578d31b
commit 9bc6ac6679
2 changed files with 592 additions and 20 deletions

View File

@@ -853,13 +853,13 @@ test "astgen: corpus astgen_test.zig" {
}
test "astgen: corpus array_list.zig" {
if (true) return error.SkipZigTest; // TODO: missing assign_destructure handler
if (true) return error.SkipZigTest; // TODO: +2 ALLOC_MUT / -2 EXTENDED tag mismatch at [6639]
const gpa = std.testing.allocator;
try corpusCheck(gpa, @embedFile("../lib/std/array_list.zig"));
}
test "astgen: corpus multi_array_list.zig" {
if (true) return error.SkipZigTest; // TODO: identifier resolution across namespace scopes
if (true) return error.SkipZigTest; // TODO: parser bug - C parser produces nodes_len=1
const gpa = std.testing.allocator;
try corpusCheck(gpa, @embedFile("../lib/std/multi_array_list.zig"));
}