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

ELSIF conditional regression #1400

Open
mhasel opened this issue Feb 4, 2025 · 0 comments
Open

ELSIF conditional regression #1400

mhasel opened this issue Feb 4, 2025 · 0 comments
Labels
bug Something isn't working regression This used to work, but no longer does

Comments

@mhasel
Copy link
Member

mhasel commented Feb 4, 2025

#1379 has resulted in a regression when evaluating ELSIF conditions if said condition contains a call to a function with aggregate return types. Due to the way the AST is lowered, these calls will now always be evaluated even if any of the previous conditional blocks already evaluated as TRUE, possibly leading to side-effects.

A possible solution to this is further lowering IF conditional blocks and nesting each ELSIF statement in a separate IF THEN ELSE statement within the previous conditions ELSE block, i.e.

IF condition THEN
    // ...
ELSIF condition2 THEN
    // ...
END_IF

should turn into

IF condition THEN
    // ...
ELSE
    IF condition2 THEN
        // ...
    ELSE
        // ...
    END_IF
END_IF
@mhasel mhasel added bug Something isn't working regression This used to work, but no longer does labels Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working regression This used to work, but no longer does
Projects
None yet
Development

No branches or pull requests

1 participant