-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Serialization: Recover from failure to deserialize inheritance clause entries #24912
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
Serialization: Recover from failure to deserialize inheritance clause entries #24912
Conversation
f853af0
to
939a248
Compare
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 didn't read the third commit too closely, but we can't drop any conformances until we can detect that when deserializing BoundGenericTypes. I think we have to stick to the first commit for now.
handleInherited(theEnum, | ||
rawInheritedAndDependencyIDs.slice(0, numInheritedTypes)); | ||
auto rawInheritedIDs = rawInheritedAndDependencyIDs.slice(0, numInherited); | ||
handleInherited(theEnum, rawInheritedIDs); |
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 just merged the class and struct versions for this, so you can switch to it if you want.
|
||
public struct S : PrivateProtocol, PublicProtocol {} | ||
public enum E : PrivateProtocol, PublicProtocol {} | ||
public class C : PrivateProtocol, PublicProtocol {} |
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.
Needs an extension test case that doesn't involve nested types. I wonder if just asking swift-ide-test
to print the module will have the right balance of "deserialize all the things, but don't do any lookups".
if (!module) | ||
module = getAssociatedModule(); | ||
return llvm::make_error<XRefNonLoadedModuleError>(getIdentifier(moduleID)); | ||
|
||
SmallVector<ProtocolConformance *, 2> conformances; | ||
nominal->lookupConformance(module, proto, conformances); | ||
PrettyStackTraceModuleFile traceMsg( | ||
"If you're seeing a crash here, check that your SDK and dependencies " | ||
"are at least as new as the versions used to build", *this); |
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.
When this is working, this crash message can go away, since it's going to recover.
auto conf = readConformance(DeclTypeCursor); | ||
auto maybeConf = readConformanceChecked(DeclTypeCursor); | ||
if (!maybeConf) { | ||
llvm::consumeError(maybeConf.takeError()); |
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.
This absolutely can't happen until we can drop BoundGenericTypes that rely on the conformance. :-(
939a248
to
8875b48
Compare
Here's a new version with the first commit only, and a test case that use swift-ide-test to trigger extension deserialization but not member lookup. |
@swift-ci Please smoke test |
Can you make sure this doesn't recover transparently for protocols? I don't want to introduce miscompiles. |
… entries ... by dropping them. Fixes <rdar://problem/50473619>.
8875b48
to
5b2211d
Compare
@jrose-apple Done. |
@swift-ci Please smoke test |
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.
Thank you for taking this! And I look forward to doing the more ambitious stuff in the future (maybe some of it on master now, even).
@swift-ci Please test source compatibility |
... by dropping them.
Fixes rdar://problem/50473619.