Skip to content

Don't use __derived_enum_equals for a resilient synthesized '==' #18508

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

Conversation

jrose-apple
Copy link
Contributor

(or __derived_struct_equals)

We want to make sure that if someone replaces the synthesized implementation with a handwritten one, it doesn't change the ABI. The simplest way to do that is to not use this clever workaround from #8735.

SR-8294 / rdar://problem/42302849

(or __derived_struct_equals)

We want to make sure that if someone replaces the synthesized
implementation with a handwritten one, it doesn't change the ABI.
The simplest way to do that is to not use this clever workaround.

https://bugs.swift.org/browse/SR-8294
@jrose-apple jrose-apple requested a review from graydon August 4, 2018 00:00
@jrose-apple
Copy link
Contributor Author

@graydon, I figure we can think of something better later if we want; I just don't want to paint ourselves into a corner. What do you think?

@swift-ci Please test

Copy link
Contributor

@graydon graydon left a comment

Choose a reason for hiding this comment

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

I don't have a great mental model for all the possible resilience scenarios to know if this "covers everything", but the code synthesis change looks right to me and I understand at least the outlines of the problem being solved by it, seems reasonable.

@graydon
Copy link
Contributor

graydon commented Aug 4, 2018

(@jrose-apple btw, thanks for doing this!)

@slavapestov
Copy link
Contributor

@jrose-apple Ok, I guess ideally, the synthesized witness would be private, and we would support 'opaque witnesses'; then it wouldn't get a symbol at all.

Note that a top-level operator has a different mangling than a static method operator too...

@jrose-apple
Copy link
Contributor Author

It's not about the witness case; it's about direct calls not backwards-deploying.

I'm not sure what to do about the top-level thing, but at least there's not really a reason to use a top-level operator with a concrete type anymore.

@jrose-apple jrose-apple merged commit 0556005 into swiftlang:master Aug 6, 2018
@jrose-apple jrose-apple deleted the derivation-is-the-sincerest-form-of-flattery branch September 10, 2018 23:21
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.

3 participants