Skip to content

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

Merged

Conversation

slavapestov
Copy link
Contributor

... by dropping them.

Fixes rdar://problem/50473619.

@slavapestov slavapestov requested a review from jrose-apple May 20, 2019 17:15
@slavapestov slavapestov force-pushed the drop-inherited-clause-entries branch from f853af0 to 939a248 Compare May 20, 2019 18:27
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.

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);
Copy link
Contributor

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 {}
Copy link
Contributor

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);
Copy link
Contributor

@jrose-apple jrose-apple May 20, 2019

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());
Copy link
Contributor

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

@slavapestov slavapestov force-pushed the drop-inherited-clause-entries branch from 939a248 to 8875b48 Compare May 20, 2019 20:08
@slavapestov
Copy link
Contributor Author

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.

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@jrose-apple
Copy link
Contributor

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>.
@slavapestov slavapestov force-pushed the drop-inherited-clause-entries branch from 8875b48 to 5b2211d Compare May 20, 2019 21:38
@slavapestov
Copy link
Contributor Author

@jrose-apple Done.

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke 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.

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).

@jrose-apple
Copy link
Contributor

@swift-ci Please test source compatibility

@slavapestov slavapestov merged commit 93293c7 into swiftlang:master May 21, 2019
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