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

implement packed struct equality #21679

Merged
merged 2 commits into from
Oct 13, 2024
Merged

Conversation

Rexicon226
Copy link
Contributor

closes #21678

Copy link
Member

@andrewrk andrewrk left a comment

Choose a reason for hiding this comment

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

Nice!

test/behavior/packed_struct_equality.zig Outdated Show resolved Hide resolved
@Rexicon226 Rexicon226 force-pushed the packed-equality branch 2 times, most recently from fea8e18 to aa38854 Compare October 12, 2024 07:21
@rohlem
Copy link
Contributor

rohlem commented Oct 12, 2024

I don't see an explicit mention (nor test) of this, but IMO a == b should still be a compile error if @TypeOf(a) != @TypeOf(b).
I assume the unchanged parts of the code already provide this behavior?

@Rexicon226
Copy link
Contributor Author

I don't see an explicit mention (nor test) of this, but IMO a == b should still be a compile error if @TypeOf(a) != @TypeOf(b). I assume the unchanged parts of the code already provide this behavior?

It's a compile error because comparisons are peer resolves, and two different packed structs types cannot coerce into each other.

@andrewrk andrewrk merged commit e131a2c into ziglang:master Oct 13, 2024
10 checks passed
@andrewrk andrewrk added the release notes This PR should be mentioned in the release notes. label Oct 13, 2024
@Rexicon226
Copy link
Contributor Author

@andrewrk will you write the release notes or should I?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release notes This PR should be mentioned in the release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

allow equality operator for packed structs
6 participants