Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Rework ifs transform #245

Merged
merged 3 commits into from
Jul 25, 2024
Merged

fix: Rework ifs transform #245

merged 3 commits into from
Jul 25, 2024

Conversation

DavePearce
Copy link
Collaborator

This reworks the ifs transform to use a simpler approach which should be easier to understand and maintain. Following the original corset implementation, this applies some optimisations in various cases.

This adds several test cases which illustrate problems with if
conditions.
This replaces these functions with `lower_expr()` which more closely
follows the Go implementation.  Currently, this is passing all tests but
needs more work to be sure.  A few points:

* Need to remove the now redundant code.
* Need to better manage optimisation of constant expressions.

The problem with the latter is that we probably need to do the constant
evaluation at the point of an `if` condition.
This removes the old implementation, and applies some (relatively
simple) optimisation to remain consistent with the original corset.
@DavePearce DavePearce linked an issue Jul 24, 2024 that may be closed by this pull request
@DavePearce DavePearce merged commit fcd3035 into master Jul 25, 2024
1 check passed
@DavePearce DavePearce deleted the 243-rework-ifs-transform branch July 25, 2024 00:02
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.

Rework ifs transform
1 participant