-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Set correct priority for ?: operator #12075
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
Set correct priority for ?: operator #12075
Conversation
@DamirAinullin Can you please open an issue first to better describe the issue? |
@daxian-dbw this is just code-reated problem, incorrect operator priority. I don't know what else should I describe in issue. |
@DamirAinullin A repro would be helpful to understand the problem. Also, for a bug, it's recommended to open an issue before submitting a PR. |
@daxian-dbw I don't have the reproducing case. |
@DamirAinullin My apology! I thought it was the chain operator and ternary operator introduced into PowerShell 7, and didn't realize you were taking about the C# operators. For subtle things like this one, no need to open an issue. Your changes look good to me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@DamirAinullin Thanks for your contribution! |
🎉 Handy links: |
PR Summary
PR Context
There is an operator precedence error in
Binders.cs
.Because the '&&' operator's priority is higher than that of '?:', the 'x.Item1.Equals(y.Item1) && x.Item2 == null' expression will be calculated at first. To fix such behavior I suggest to add parentheses for '?:' expression.
PR Checklist
.h
,.cpp
,.cs
,.ps1
and.psm1
files have the correct copyright headerWIP:
or[ WIP ]
to the beginning of the title (theWIP
bot will keep its status check atPending
while the prefix is present) and remove the prefix when the PR is ready.