Skip to content

Support logical operator type inference with union type approximation#31

Merged
dak2 merged 1 commit intomainfrom
infer-operator-type
Feb 23, 2026
Merged

Support logical operator type inference with union type approximation#31
dak2 merged 1 commit intomainfrom
infer-operator-type

Conversation

@dak2
Copy link
Owner

@dak2 dak2 commented Feb 23, 2026

&& and || are short-circuit operators that return one of their operands rather than a boolean. Since we cannot determine truthiness at static analysis time, we conservatively model the result as a union of both sides' types. This prevents false positives when methods are called on the result of logical expressions (e.g. ("a" && "b").upcase).

Ruby's && and || are short-circuit operators that return one of their
operands rather than a boolean. Since we cannot determine truthiness
at static analysis time, we conservatively model the result as a union
of both sides' types. This prevents false positives when methods are
called on the result of logical expressions (e.g. `("a" && "b").upcase`).
@dak2 dak2 merged commit e7becec into main Feb 23, 2026
2 checks passed
@dak2 dak2 deleted the infer-operator-type branch February 23, 2026 00:43
@dak2 dak2 mentioned this pull request Feb 23, 2026
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.

1 participant