Implement Null Coalescing and Null Coalescing assignment operators - #10636
Conversation
|
FYI this will clash with Posh-Git that implements an alias of |
|
We've already moved the use of |
Rob Holt (rjmholt)
left a comment
There was a problem hiding this comment.
Really nice that this didn't require any changes to the parser and generally quite contained elsewhere -- feels like a vindication of good code for assignment processing.
Left a few comments.
| /// and all of the case sensitive variants of these operators, if they exists. | ||
| /// </summary> | ||
| BinaryPrecedenceComparison = 3, | ||
| BinaryPrecedenceComparison = 0x5, |
There was a problem hiding this comment.
Since enum's are treated like constants, this would be a breaking change for compiled projects right?
There was a problem hiding this comment.
Yes, this will be a breaking change. We are expecting the impact to very small though. I have updated the PR Context in description with more details.
commented
Oct 12, 2019
|
This issue has changes that could potentially change syntax. Please consider adding this feature to EditorSyntax which is used for syntax highlighting in GitHub, Visual Studio Code, Atom, Sublime Text, and many more locations. Consistent syntax highlighting is very important for the language and a feature isn't "complete" until syntax highlighting is what is expected. If you can't contribute to EditorSyntax, at least open an issue to track the work - however, please note, that no one is actively working on the repo and so the work will likely not get done in a timely manner. We hope that you consider contributing to EditorSyntax. (note this is copy/pasted text for any change that looks like it could impact EditorSyntax - and will be a bot in the future) |
commented
Oct 12, 2019
|
(thanks for opening the issue already!) |
commented
Oct 15, 2019
|
It just occurred to me that none of the existing |
commented
Oct 15, 2019
It looks like that's just a question of the token flag: PowerShell/src/System.Management.Automation/engine/parser/ConstantValues.cs Lines 196 to 201 in beb8b44 |
commented
Oct 15, 2019
|
Dongbo Wang (@daxian-dbw) I will review all the existing |
commented
Oct 16, 2019
|
@PowerShell/powershell-committee reviewed the changes to |
commented
Oct 23, 2019
|
🎉 Handy links: |
PR Summary
Implement the Null Coalescing
??and Null Coalescing Assignment??=operators.PR Context
The operators are discussed in the issue #3240
This PR addresses part of RFC PowerShell/PowerShell-RFC#223
The PR is marked as a
Breaking Changedue to changes in theTokenFlagsenum. The changes were made to include the new TokenFlag -BinaryPrecedenceCoalesce. While making this change, it was also decided to create more space in the BinaryPrecedence section of the enum for future binary operators. TheBinaryPrecedenceMaskwas also changed from0x07to0x0f. The order of precedence is not changed. We expected it can cause a breaking change for binary modules as C# treats enums as constants. Though, it is a breaking change we expect the impact to be pretty low as the usage of precedence token flags should be fairly low.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.????=?.and?[]operators MicrosoftDocs/PowerShell-Docs#4925????=?.?[]operators EditorSyntax#185