{{ message }}
Set correct priority for ?: operator#12075
Merged
iSazonov merged 1 commit intoPowerShell:masterfrom Mar 19, 2020
Merged
Conversation
Member
Contributor
Author
|
@daxian-dbw this is just code-reated problem, incorrect operator priority. I don't know what else should I describe in issue. |
Member
|
@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. |
Contributor
Author
|
@daxian-dbw I don't have the reproducing case. |
Member
|
@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. |
iSazonov
approved these changes
Mar 19, 2020
Collaborator
|
@DamirAinullin Thanks for your contribution! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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.