Skip to content

fix: var_temp indices are no longer referenced in call assignment#1617

Merged
Angus-Bethke-Bachmann merged 13 commits intomasterfrom
anbt/PRG-3671
Mar 19, 2026
Merged

fix: var_temp indices are no longer referenced in call assignment#1617
Angus-Bethke-Bachmann merged 13 commits intomasterfrom
anbt/PRG-3671

Conversation

@Angus-Bethke-Bachmann
Copy link
Copy Markdown
Contributor

Changed

  • VAR_TEMP indices are no longer referenced in call assignment

Testing

  • Added codegen tests to verify positional assignment for named and implicit parameters when VAR_TEMP interrupts position in struct
  • Added lit test to ensure values are assigned correctly and that no LLVM error is present

Copy link
Copy Markdown
Member

@mhasel mhasel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found two remaining edge cases - I've pushed failing tests that showcase them.

  1. function_block_with_var_temp_should_compile_when_output_has_direct_access - panics at expression_generator.rs:942, where build_struct_gep still uses the raw position.
  2. function_block_with_var_temp_before_input_should_compile - compiles but emits i32 1 instead of i32 0 for the GEP of an input parameter declared after a VAR_TEMP block.

The second test includes an inline snapshot of the correct expected IR so the failure shows a clear diff.

To verify, please also add LIT tests for both cases.

Comment thread src/codegen/generators/expression_generator.rs Outdated
Comment thread src/codegen/generators/expression_generator.rs Outdated
@Angus-Bethke-Bachmann Angus-Bethke-Bachmann merged commit 0b1bf99 into master Mar 19, 2026
33 checks passed
@Angus-Bethke-Bachmann Angus-Bethke-Bachmann deleted the anbt/PRG-3671 branch March 19, 2026 13:46
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.

2 participants