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
[stdlib] Set, Dictionary: Fix (cocoa, native) equatable implementation #33093
Conversation
@@ -415,7 +415,7 @@ extension Set: Equatable { | |||
case (true, false): | |||
return lhs._variant.asNative.isEqual(to: rhs._variant.asCocoa) | |||
case (false, true): | |||
return rhs._variant.asNative.isEqual(to: lhs._variant.asCocoa) |
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.
I was knee deep in Set guts trying to figure out how this managed to remain undetected for so long, but it turns out the original code is correct! Unlike the rest of the cases, here isEqual(to:)
is called on rhs
, not lhs
. (_CocoaSet.isEqual(to:)
does not support a native argument, so this line wouldn't compile with the suggested change.)
This is way too subtle. I blame the terrible naming convention lhs
and rhs
-- naming these parameters left
and right
would've highlighted the swap much better. Would you like to rename them?
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.
oh! I see, in this case the lhs
and rhs
were reversed! The naming does make it hard to notice that. Let me reorder them instead, sorry for the false alarm
…le implementation
@lorentey I think this is ready for another pass & potentially to be merged |
@AndrewSB The current version won't work, either, for the same reason I wrote above:
Stepping back, what concrete problem are you addressing with this PR? Have you verified that your change builds & runs locally before submitting this for review? |
@swift-ci smoke test |
|
Assuming there is a bug in this code that this PR fixes, please add tests for it -- thanks! |
@AndrewSB I'm closing this as it isn't building in this stage, and I don't see what problem these changes are addressing. Feel free to submit a new PR if there is an issue to be resolved. |
I was looking through the implementation of set and this change felt off to me.
@lorentey it looks like you changed this last, what do you think?