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

[bug] Cached operations propagate incorrectly in ternary expressions #176

Open
JeanJPNM opened this issue May 13, 2023 · 0 comments
Open
Labels
bug Something isn't working
Milestone

Comments

@JeanJPNM
Copy link
Collaborator

JeanJPNM commented May 13, 2023

The following example shows that the operation a + 1 is reused on the alternate branch, even though it
can only be executed in the consequent branch.

const a = Math.rand(10)
const b = a > 5 ? (a + 1) * 2 : (a + 1) * 3

Output:

op rand a:1:6 10
jump 5 lessThanEq a:1:6 5
op add &t0 a:1:6 1
op mul b:2:6 &t0 2
jump 6 always
op mul b:2:6 &t0 3
end

Version: latest (a9676c1)
Similar to #144.

@JeanJPNM JeanJPNM added the bug Something isn't working label May 13, 2023
@JeanJPNM JeanJPNM added this to the v0.7 milestone Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant