Skip to content

Elide total unused Lua tuple components - #1283

Merged
Frotty merged 1 commit into
masterfrom
codex/lua-tuple-component-demand
Sep 3, 2026
Merged

Elide total unused Lua tuple components#1283
Frotty merged 1 commit into
masterfrom
codex/lua-tuple-component-demand

Conversation

@Frotty

@Frotty Frotty commented Sep 3, 2026

Copy link
Copy Markdown
Member

Summary

  • let Lua tuple lowering discard recursively total scalar operator expressions when their component is unused
  • retain evaluation for calls, member/array accesses, integer division, modulo, and other expressions which can have effects or fail
  • document that the existing post-lowering garbage pass already removes unread tuple return slots and their pure producers

Generated Lua

For pair(left + 1, right + 2).x, the generated function now computes and returns only left + 1. It emits neither right + 2 nor a __wurst_tuple_discard_* helper.

Verification

  • regression demonstrated red before the implementation and green afterward
  • ./gradlew.bat test --tests "tests.wurstscript.tests.LuaBackendAuditTests" --tests "tests.wurstscript.tests.TupleTests"
  • ./gradlew.bat test
  • git diff --check

All checks pass locally. The full suite completed successfully in 4m27s.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 3, 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-09-03T08:36:55.227611Z 16983b0 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 0da3c2f into master Sep 3, 2026
3 checks passed
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