Skip to content

Mark vars in AST of ||, &&, if, and unless as generated#15328

Open
arnodirlam wants to merge 1 commit intoelixir-lang:mainfrom
arnodirlam:fix/mark-vars-in-logical-operators-ast-as-generated
Open

Mark vars in AST of ||, &&, if, and unless as generated#15328
arnodirlam wants to merge 1 commit intoelixir-lang:mainfrom
arnodirlam:fix/mark-vars-in-logical-operators-ast-as-generated

Conversation

@arnodirlam
Copy link
Copy Markdown
Contributor

@arnodirlam arnodirlam commented Apr 30, 2026

Commit 19c628a introduced a private AST helper Kernel.x_is_false_or_nil/0 to add generated: true to a generated variable x in generated guards for of ||, &&, if, and unless (diff).

However, the variable x, on which the guards refer to, is not marked as generated: true, and thus has a different AST signature.

For reference, see this diff (expand to see lines 1070-1135).

This PR fixes this by adding another private AST helper Kernel.x_var/0 to add generated: true to the generated variables x as well.

@josevalim
Copy link
Copy Markdown
Member

Thank you @arnodirlam. Can you please explain when/why this change would be necessary?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants