Skip to content

Serialization: Recovery for protocol conformances with changed witness or requirement signatures. #9402

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

Merged
merged 1 commit into from
May 9, 2017

Conversation

jckarter
Copy link
Contributor

@jckarter jckarter commented May 8, 2017

Deserializing a witness record in a conformance may fail if either of the requirement or witness changed name or type, most likely due to SDK modernization changes across Swift versions. When this happens, leave an opaque placeholder in the conformance to indicate that the witness exists but we don't get to see it. For expedience, right now this just witnesses the requirement to itself, so that code in the type checker or elsewhere that tries to ad-hoc devirtualize references to the requirement just gets the requirement back. Arguably, we shouldn't include the witness at all in imported conformances, since they should be an implementation detail, but that's a bigger, riskier change. This patch as is should be enough to address rdar://problem/31185053.

Replace this paragraph with a description of your changes and rationale. Provide links to external references/discussions if appropriate.

Resolves SR-NNNN.

@jckarter
Copy link
Contributor Author

jckarter commented May 8, 2017

@swift-ci Please test

@jckarter
Copy link
Contributor Author

jckarter commented May 8, 2017

@slavapestov @jrose-apple How does this look?

@swift-ci
Copy link
Contributor

swift-ci commented May 8, 2017

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - 5c315978da216a75b99d535fc1b42c373526dfe0
Test requested by - @jckarter

…s or requirement signatures.

Deserializing a witness record in a conformance may fail if either of the requirement or witness changed name or type, most likely due to SDK modernization changes across Swift versions. When this happens, leave an opaque placeholder in the conformance to indicate that the witness exists but we don't get to see it. For expedience, right now this just witnesses the requirement to itself, so that code in the type checker or elsewhere that tries to ad-hoc devirtualize references to the requirement just gets the requirement back. Arguably, we shouldn't include the witness at all in imported conformances, since they should be an implementation detail, but that's a bigger, riskier change. This patch as is should be enough to address rdar://problem/31185053.
@jckarter jckarter force-pushed the mix-and-match-witnesses branch from 5c31597 to e3e0f44 Compare May 9, 2017 16:15
@jckarter
Copy link
Contributor Author

jckarter commented May 9, 2017

@swift-ci Please test

1 similar comment
@jckarter
Copy link
Contributor Author

jckarter commented May 9, 2017

@swift-ci Please test

Copy link
Contributor

@jrose-apple jrose-apple left a comment

Choose a reason for hiding this comment

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

This looks great. Thanks, Joe!

@jckarter jckarter merged commit 1a59936 into swiftlang:master May 9, 2017
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