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

Avoid duplicating complex expression in comparisons #34172

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ranma42
Copy link
Contributor

@ranma42 ranma42 commented Jul 5, 2024

When comparing a nullable expression to a non-nullable one, a NULL result always
represent a difference.

This makes it possible to avoid duplicating the nullable expression by mapping
the NULL result to a FALSE (when comparing for equality).

Fixes #34165.

@ranma42
Copy link
Contributor Author

ranma42 commented Jul 5, 2024

This change can already take care of most of the worst offenders found in #34048 🥳

@ranma42
Copy link
Contributor Author

ranma42 commented Jul 5, 2024

I'll add some tests that check this transformation specifically
EDIT: done 👍

When comparing a nullable expression to a non-nullable one, a  `NULL` result  always
represent a difference.

This makes it possible to avoid duplicating the nullable expression by mapping
the `NULL` result to a `FALSE` (when comparing for equality).

Fixes dotnet#34165.
@ranma42 ranma42 force-pushed the avoid-equal-duplication-34165 branch from 6d85d56 to 8a4e1bf Compare July 6, 2024 12:50
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.

Investigate alternative translations for (in)equality comparison
1 participant