Skip to content

Revert "[SR-9425][Sema] Use derived conformance as witness when possible for == operator of raw representable enums" #38858

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

Closed
wants to merge 1 commit into from

Conversation

slavapestov
Copy link
Contributor

Reverts #36752 to "fix" rdar://problem/80466745.

The problem is that we assume a swiftinterface built with the older compiler has a synthesized == witness, when in fact it was relying on the generic implementation before, so the synthesized == witness is not even in the dylib.

The proper fix will be to disable automatic derivation of == in swiftinterface files, since they already spell out the conformance explicitly.

…ble for == operator of raw representable enums"
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@LucianoPAlmeida
Copy link
Contributor

The problem is that we assume a swiftinterface built with the older compiler has a synthesized == witness, when in fact it was relying on the generic implementation before, so the synthesized == witness is not even in the dylib.

Ah that's unfortunate, thank you for reverting this @slavapestov :)

The proper fix will be to disable automatic derivation of == in swiftinterface files, since they already spell out the conformance explicitly.

If I understand correctly, this implementation is still valid. We just need to make sure that together with that automatic derivation of equatable conformances don't get emitted when compiling swift interface files?

@slavapestov
Copy link
Contributor Author

If I understand correctly, this implementation is still valid. We just need to make sure that together with that automatic derivation of equatable conformances don't get emitted when compiling swift interface files?

Right, when building a swiftmodule from a swiftinterface, we can't derive the conformance, because we're not actually going to emit the witness. If the synthesized == overload does not appear in the swiftinterface, we should not assume the dylib has one, because it won't if built with an older compiler.

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@LucianoPAlmeida
Copy link
Contributor

Right, when building a swiftmodule from a swiftinterface, we can't derive the conformance, because we're not actually going to emit the witness. If the synthesized == overload does not appear in the swiftinterface, we should not assume the dylib has one, because it won't if built with an older compiler.

Ah I see, understood it now. Thank you!
I can give it a shot in fix it. Not sure when, but we can reopen the ticket and I can assign to myself to work on it again soon as possible.

@shahmishal shahmishal deleted the revert-36752-SR-9425-enum-eq branch May 13, 2022 08:47
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 this pull request may close these issues.

2 participants