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
Revert the PR #17856 (Do not preserve temporary results when no need to do so) #21368
Conversation
…n no need to do so)
|
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
not only should we do the revert, but we need to improve validation so we don't get caught by this again. I quickly saw the added validation, but couldn't see how we didn't catch this. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
1 similar comment
|
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
| It 'Return statement on the right side of an assignment should write the retrun value to outer pipe' { | ||
| function TestFunc1 { | ||
| ## The return value are not assigned to the variable but should be written to the outer pipe. | ||
| $Global:mylhsvar = if ($true) { return "one" } |
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.
It might be worth adding a few more tests here as using return changes the behavior significantly
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.
we should add more validation eventually
…n no need to do so) (PowerShell#21368)


PR Summary
Fix #20739 by reverting the PR that caused this regression: #17856
#17856 causes the return value from a
ReturnStatementto not be preserved too, which breaks an expected behavior.This is the difference compared with the same code section from v7.3. After this change, the only difference is the updated comments.
Here is the relevant code section in v7.3:
PowerShell/src/System.Management.Automation/engine/parser/Compiler.cs
Lines 2278 to 2310 in d68aa89
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.