Skip to content

Fix duplicate old-generic conversion in closure returns - #1446

Merged
Frotty merged 2 commits into
masterfrom
codex/fix-old-generic-closure-1445
Oct 13, 2026
Merged

Frotty merged 2 commits into
masterfrom
codex/fix-old-generic-closure-1445

Conversation

@Frotty

@Frotty Frotty commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Expression-bodied closures reading an old-generic string container decode the value during expression translation, then decode it again when adapting the closure return. This emits nested stringFromIndex calls, invalid Jass, and a compile-time interpreter failure.

Adapt the already-translated expression using its normalized type only when a fromIndex conversion has decoded it, so it is decoded once. Preserve other generic bindings so Lua still restores primitive defaults when an erased result becomes a typed closure return. Add runtime and compile-time regression tests, Jass output assertions, new-generic controls, and integer/real/boolean default coverage on both backends. Supply the test Lua runtime's Filter factory needed by the imported stdlib initialization.

Also test the bundled pjass argument-count boundary and document measurements on Warcraft III 3.0.0.24268: 31 parameters work, including a receiver/varargs/trace-shaped signature and a package-init call; 32-parameter calls cause client process exit and are already rejected by Wurst and pjass.

Validation: 343 tests passed across ClosureTests, the full LuaBackendAuditTests class, VarargTests, and PjassTests. Both old-generic repros failed with the original translation and passed with this fix. The CI primitive-default failure was reproduced locally before narrowing the normalization. Real-client probes verified every argument from runtime-derived values.

Fixes #1445.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T05:26:04.963905Z 3444aec PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Frotty
Frotty merged commit 7af0055 into master Oct 13, 2026
3 checks passed
@Frotty
Frotty deleted the codex/fix-old-generic-closure-1445 branch October 13, 2026 06:36
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.

Closure over old-generic string container emits double stringFromIndex (invalid Jass / interpreter crash)

1 participant