Repository navigation
fix(codegen): store a reordered record literal by the expected layout (#817) - #821
Conversation
|
Review these changes at https://app.gitnotebooks.com/hyperpolymath/affinescript/pull/821 |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 10 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…#817) Core WASM stored a record literal in its source field order, but reads used the declared type's layout or the first literal's layout. Two cases returned the wrong field. When the expected layout is known, each field is now stored at that offset. Field values still run in source order. The layout comes from: - a `let` type annotation; - the variable's layout, for a local reassignment; - the callee's parameter type, for a literal passed as an argument; - the fn return type, for a tail literal and `return #{..}`. Closes #817 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0136P7ZjyGGiPhiEUxNGPwsr
6d0cd7a to
f9cbe89
Compare
|



Closes #817
Summary
Core WASM stored a record literal in its source field order, but reads used the declared type's layout or the first literal's layout. Both repros in #817 returned the wrong field.
Now, when the expected layout is known,
gen_record(lib/codegen.ml) stores each field at that layout's offset. Field values still run in source order. The layout comes from:lettype annotation (let x: Config = #{height: 9, width: 2});r = #{right: 7, left: 3});h(#{height: 9, width: 2}));return #{..}.Limits
iformatchbranch of a reassignment still uses source order. The codegen(wasm): lower module state and qualified host calls (#561) #814 checks for globals are unchanged.Tests
tests/codegen/test_record_field_order.mjs: both repros, direct argument, tail return, earlyreturn, and the same-order case. It fails on main (first assert) and passes here.Generated by Claude Code