Skip to content

Fix bug in handling of blocks that occur in expresssions#672

Open
keyboardDrummer wants to merge 15 commits intomainfrom
fixImpureExpressionBlockHandling
Open

Fix bug in handling of blocks that occur in expresssions#672
keyboardDrummer wants to merge 15 commits intomainfrom
fixImpureExpressionBlockHandling

Conversation

@keyboardDrummer
Copy link
Contributor

@keyboardDrummer keyboardDrummer commented Mar 26, 2026

Changes

  • Fix bug in handling of blocks that occur in expressions. The heart of the problem was that transformStmt, which does not update the substitution map, was being called from inside transformExpr when it was handling a block, leading to missing substitutions. A second but smaller bug was a statement ordering bug that occurred when handling calls.

Testing

  • Added test-case

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@keyboardDrummer keyboardDrummer requested review from a team and olivier-aws March 26, 2026 10:49
joscoh
joscoh previously approved these changes Mar 26, 2026
Copy link
Contributor

@joscoh joscoh left a comment

Choose a reason for hiding this comment

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

Can you update the PR with a short description of what the bug is?

@keyboardDrummer keyboardDrummer requested a review from joscoh March 26, 2026 16:55
| [] => return []
| _ =>
let last := stmts.getLast!
let nonLast ← stmts.dropLast.flatMapM (fun s =>
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't every case return pure []? Why return a list at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True but it's only because of the hacks, otherwise the localvars, assert/assumes would fill the list.

@keyboardDrummer keyboardDrummer requested a review from joscoh March 27, 2026 08:54
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