Skip to content

[4.0] Serialization: Recovery for protocol conformances with changed witness or requirement signatures. #9403

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

Conversation

jckarter
Copy link
Contributor

@jckarter jckarter commented May 8, 2017

Explanation: 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.

Scope: Required to mix-and-match S3 and S4 modules.

Issue: rdar://problem/31185053

Risk: Moderate, should not impact mono-version projects, but requires additional testing to validate in the wild with real mixed projects once those exist.

Testing: Swift CI

@jckarter
Copy link
Contributor Author

jckarter commented May 8, 2017

@swift-ci Please test

@jckarter jckarter changed the title Serialization: Recovery for protocol conformances with changed witness or requirement signatures. [4.0] Serialization: Recovery for protocol conformances with changed witness or requirement signatures. May 8, 2017
@swift-ci
Copy link
Contributor

swift-ci commented May 8, 2017

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - a5ccab62ca69f8c05d2c5efc4adc6c849246884f
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-4.0 branch from a5ccab6 to baa99c6 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

@jckarter jckarter merged commit a817109 into swiftlang:swift-4.0-branch 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.

2 participants