Skip to content

perf(ir): flatten a sequence whose only meta is outputs - #83

Merged
nx10 merged 1 commit into
mainfrom
flatten-meta-only-outputs
Jul 28, 2026
Merged

perf(ir): flatten a sequence whose only meta is outputs#83
nx10 merged 1 commit into
mainfrom
flatten-meta-only-outputs

Conversation

@nx10

@nx10 nx10 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

An anonymous set(...) lowers to a sequence carrying only the outputs its members declared, which flatten refused to inline, leaving a pointless nested struct in generated code (bet shipped a BetStruct1 the caller had to build). Inline it and hoist the outputs onto the parent, which is now their scope.

The merge is guarded: it is refused when it would collide two same-named bindings, or re-resolve a hoisted output's ref to a different binding. The frontend dedupes sibling names per scope long before this pass runs, so it never sees the merged namespace.

Generated Python for all 1919 NiWrap descriptors is byte-identical to main.

An anonymous `set(...)` lowers to a sequence carrying just the outputs its
members declared, which `flatten` refused to inline (`!child.meta`), leaving a
pointless nested struct in generated code. Inline it and hoist the outputs onto
the parent, which is now their scope.

Guard the merge: refuse when it would collide two same-named bindings, or
re-resolve a hoisted output ref to a different binding. The frontend dedupes
sibling names per scope long before this pass, so it never sees the merged
namespace - a collision silently dropped a parameter (already possible for a
meta-less child on main, now fixed too).
@nx10
nx10 merged commit a74a961 into main Jul 28, 2026
3 checks passed
@nx10
nx10 deleted the flatten-meta-only-outputs branch July 28, 2026 17:22
@nx10 nx10 mentioned this pull request Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant