Skip to content

Fix guard equality with short-circuit operators#15257

Closed
gldubc wants to merge 1 commit intoelixir-lang:mainfrom
gldubc:issue-15253-guard-equality
Closed

Fix guard equality with short-circuit operators#15257
gldubc wants to merge 1 commit intoelixir-lang:mainfrom
gldubc:issue-15253-guard-equality

Conversation

@gldubc
Copy link
Copy Markdown
Member

@gldubc gldubc commented Apr 10, 2026

Closes #15253.

This fixes guard evaluation for andalso and orelse when they appear on the right side of a comparison. The issue happens after analysis, while of_guard re-evaluates the guard call.

The fix only uses the pattern-specific guard handling when pattern_info is available. Otherwise it dispatches through Apply.remote (as of_remote does with other cases such as the comparisons @comp_op), with signatures for andalso and orelse added there to preserve type precision.

@josevalim
Copy link
Copy Markdown
Member

Unfortunately andalso and orelse mean boolean, term, so we need to adapt it accordingly. I will take it from here, thank you!!!!

@josevalim josevalim closed this in 469acb1 Apr 11, 2026
@gldubc gldubc deleted the issue-15253-guard-equality branch April 13, 2026 14:38
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.

Compiler crash in type checker when using logical operator with equality guard

2 participants