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. |
|
@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,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.