Use more effective evaluation order in LanguagePrimitives.IsNullLike()#10781
Merged
iSazonov merged 1 commit intoPowerShell:masterfrom Oct 16, 2019
Merged
Use more effective evaluation order in LanguagePrimitives.IsNullLike()#10781iSazonov merged 1 commit intoPowerShell:masterfrom
iSazonov merged 1 commit intoPowerShell:masterfrom
Conversation
Collaborator
|
It was in #9794 (milestone 7.0-Preview2) as a breaking change without PowerShell Committee approve. So add the labels. |
iSazonov
approved these changes
Oct 12, 2019
Collaborator
Author
|
@iSazonov the committee approved the change in the original issue (see #9561 (comment)) 🙂 |
Collaborator
|
My concern about order. |
Member
|
Why is changing the order a breaking change? It doesn't change the behavior of this method, does it? |
Collaborator
Author
|
Nope, it still checks the same things, just in a different order. 🙂 |
Collaborator
|
I see the logic is more simple than I thought. |
adityapatwardhan
approved these changes
Oct 15, 2019
|
🎉 Handy links: |
daxian-dbw
added a commit
to daxian-dbw/PowerShell
that referenced
this pull request
Jan 14, 2020
…ullLike() (PowerShell#10781)" This reverts commit 25286eb.
This was referenced Jan 14, 2020
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
Refactor
IsNullLike()to evaluate the most commonly-expectednull-like values first.New order of evaluation:
IsNull(value):value == nullvalue == AutomationNull.Valuevalue == DBNull.Valuevalue == AutomationNull.ValuePR Context
IsNullLike()is used in binders like-eq(e.g.,$null -eq $value)and it makes the most sense to evaluate in order of the most common null/null-like values first so that the code path short-circuits in the most common situations.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.