Skip to content

C++/C#/JS/Python: Replace 'if p() then q() else none()' with a conjunction #6865

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

Merged
merged 4 commits into from
Oct 13, 2021

Conversation

MathiasVP
Copy link
Contributor

The pattern if p() then q() else none() is equivalent to p() and q(). Likewise, the pattern if p() then none() else q() is equivalent to not p() and q().

@MathiasVP MathiasVP requested review from a team as code owners October 13, 2021 10:47
@MathiasVP MathiasVP added the no-change-note-required This PR does not need a change note label Oct 13, 2021
Copy link
Contributor

@aschackmull aschackmull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disagree on fixing the cases nested inside another else.

@MathiasVP MathiasVP removed the Java label Oct 13, 2021
@MathiasVP MathiasVP changed the title C++/C#/Java/JS/Python: Replace 'if p() then q() else none()' with a conjunction C++/C#/JS/Python: Replace 'if p() then q() else none()' with a conjunction Oct 13, 2021
@MathiasVP
Copy link
Contributor Author

I've removed the results that @aschackmull didn't like and force-pushed the new changes.

Copy link
Contributor

@geoffw0 geoffw0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but this should probably get a quick review from each language team.

@smowton smowton dismissed aschackmull’s stale review October 13, 2021 18:31

Requested change applied

@smowton
Copy link
Contributor

smowton commented Oct 13, 2021

@MathiasVP dismissed @aschackmull's review as his requested changes have been applied

@MathiasVP
Copy link
Contributor Author

@MathiasVP dismissed @aschackmull's review as his requested changes have been applied

Thanks a lot! Since all the C# changes are in code related to the IR I'll merge this without waiting on their explicit approval.

@MathiasVP MathiasVP merged commit a237137 into github:main Oct 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C# C++ JS no-change-note-required This PR does not need a change note Python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants