Skip to content
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

Remove redundant checks when comparing interfaces with the nil literal #522

Merged
merged 2 commits into from
Sep 20, 2022

Conversation

jcp19
Copy link
Contributor

@jcp19 jcp19 commented Sep 19, 2022

It is very common to compare an interface value with the literal nil. Currently, this comparison is encoded as an equality, preceded by a check that one of the operands is comparable. This check is redundant and I removed it in this PR.

@jcp19 jcp19 added the encoding label Sep 19, 2022
@jcp19 jcp19 requested a review from Felalolf September 19, 2022 19:33
@ArquintL
Copy link
Member

I would generalize your optimization such that it does not matter whether nil is on the rhs or lhs

@jcp19
Copy link
Contributor Author

jcp19 commented Sep 19, 2022

I would generalize your optimization such that it does not matter whether nil is on the rhs or lhs

I don't know how I forgot this xD thanks for reminding me!

@jcp19 jcp19 merged commit a1d4424 into master Sep 20, 2022
@jcp19 jcp19 deleted the optimize-eq-interfaces branch September 20, 2022 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants