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

equal: generated code does not check reference equality #67

Closed
marcind opened this issue Nov 22, 2022 · 0 comments · Fixed by #72
Closed

equal: generated code does not check reference equality #67

marcind opened this issue Nov 22, 2022 · 0 comments · Fixed by #72

Comments

@marcind
Copy link

marcind commented Nov 22, 2022

Expected: Generated code returns true if this and that instances are the same, i.e. msg.EqualVT(msg) should be super fast regardless of the fields in the message

Actual: Generated code still walks the whole message hierarchy and compares field-by-field

I believe implementing this should be as simple as replacing the currently generated code

if this == nil {
    return that == nil
} else if that == nil {
    return false
}

with

if this == that {
    return true
} else if this == nil || that == nil {
    return false
}

Could not find a contribution guide, so let me know if you'd like a PR for this or if you would rather make the change yourselves. Thanks for the great project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant