feat(codegen): gen-zig tuple lowering (return type + literal + destructuring) - #1725
Merged
Merged
Conversation
…cturing) Part 4 of tuple support (#1702), the Zig backend. - gen_fn_decl: tuple return type (T, U) -> Zig struct { T, U } - gen_expr: ExprTuple -> Zig anonymous tuple value .{ e0, e1 } - gen_stmt: let (s, d) = call() -> const s, const d = call(); Emitted Zig compiles under Zig 0.15.2 (zig build-obj) and comptime-evaluates: use_it(5,3)=10, dm(7,2)=(9,5). New test test_tuple_literal_and_destructuring_zig; full suite 1499/0. FROZEN_HASH re-sealed. gen-c remains (#1702). Closes #1724 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
Contributor
This was referenced Aug 5, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 4 of the tuple-support workstream (#1702). Parser + gen-rust (#1710, #1716) + gen-verilog (#1718) already landed; this is gen-zig.
Closes #1724.
Before (master) — invalid Zig
Change (3 touchpoints, additive)
gen_fn_decl— tuple return type(T, U)→ Zig anonymous tuple structstruct { T, U }.gen_exprExprTuple— tuple literal →.{ e0, e1 }.gen_stmtStmtLocal—let (s, d) = call()→const s, const d = call();.After
Verification
zig build-obj) and comptime-evaluates:use_it(5, 3) == 10,dm(7, 2) == (9, 5).test_tuple_literal_and_destructuring_zig; full unit suite 1499/0.Pre-existing unrelated failures
bitnet_top::{top_busy_from_current_layer_or_layer_start, top_mem_outputs_tied_off}reproduced on cleanorigin/master— not introduced here (they were previously masked becausebitnet_pipelineaborted the run first). Will be tracked/fixed separately.gen-c is the last remaining backend on #1702.
🤖 Generated with Claude Code