Skip to content

[NCGenerics] Serialization for noncopyable generic types. #70180

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 3 commits into from
Dec 13, 2023

Conversation

kavon
Copy link
Member

@kavon kavon commented Dec 2, 2023

This PR covers serialization and deserialization of ~Copyable types when NoncopyableGenerics is enabled. This means that you can now write:

public protocol P: ~Copyable {}

and emit Swift module containing that type, to be imported by another module.

resolves rdar://118947007&119531975

@kavon
Copy link
Member Author

kavon commented Dec 2, 2023

@swift-ci please test

@kavon
Copy link
Member Author

kavon commented Dec 2, 2023

swiftlang/llvm-project#7842
@swift-ci please smoke test

@kavon kavon force-pushed the noncopyable-serialization branch from 5eed9d8 to f9f80fa Compare December 3, 2023 22:37
@kavon
Copy link
Member Author

kavon commented Dec 3, 2023

@swift-ci smoke test

@kavon kavon force-pushed the noncopyable-serialization branch 6 times, most recently from c9c3b3f to 8712f11 Compare December 12, 2023 05:01
@kavon
Copy link
Member Author

kavon commented Dec 12, 2023

@swift-ci smoke test

@kavon kavon force-pushed the noncopyable-serialization branch from 8712f11 to 04e5c4c Compare December 12, 2023 07:22
@kavon
Copy link
Member Author

kavon commented Dec 12, 2023

@swift-ci smoke test

@kavon kavon force-pushed the noncopyable-serialization branch from 04e5c4c to 6f9a641 Compare December 12, 2023 17:47
@kavon kavon marked this pull request as ready for review December 12, 2023 17:48
@kavon
Copy link
Member Author

kavon commented Dec 12, 2023

@swift-ci please smoke test

@kavon kavon enabled auto-merge December 12, 2023 17:57
@@ -6920,11 +6920,16 @@ DESERIALIZE_TYPE(GENERIC_TYPE_PARAM_TYPE)(

Expected<Type> DESERIALIZE_TYPE(PROTOCOL_COMPOSITION_TYPE)(
ModuleFile &MF, SmallVectorImpl<uint64_t> &scratch, StringRef blobData) {
bool hasExplicitAnyObject;
bool hasExplicitAnyObject, hasInverseCopyable, hasInverseEscapable;
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should have an OptionSet for PCT flags at this point

@kavon kavon force-pushed the noncopyable-serialization branch from 6f9a641 to 6f79d24 Compare December 12, 2023 18:45
@kavon
Copy link
Member Author

kavon commented Dec 12, 2023

@swift-ci please smoke test

@kavon
Copy link
Member Author

kavon commented Dec 12, 2023

@swift-ci please smoke test macOS platform

@kavon kavon force-pushed the noncopyable-serialization branch from 6f79d24 to 027718b Compare December 12, 2023 22:06
@kavon
Copy link
Member Author

kavon commented Dec 12, 2023

@swift-ci please smoke test

resolves rdar://118947007
We can't simply emit the desugared, expanded version of the requirements
because there's no way to pretty-print the type `some ~Copyable` when
the `~Copyable`'s get replaced with the absence of `Copyable`. We'd be
left with just `some _` or need to invent a new top type so we can write
`some Top`. Thus, it's best to simply reverse the expansion of default
requirements when emitting a swiftinterface file.
@kavon kavon force-pushed the noncopyable-serialization branch from 027718b to bd13307 Compare December 13, 2023 00:40
@kavon
Copy link
Member Author

kavon commented Dec 13, 2023

@swift-ci please smoke test

@kavon
Copy link
Member Author

kavon commented Dec 13, 2023

@swift-ci please smoke test linux platform

1 similar comment
@kavon
Copy link
Member Author

kavon commented Dec 13, 2023

@swift-ci please smoke test linux platform

@kavon kavon merged commit 5988608 into swiftlang:main Dec 13, 2023
@kavon kavon deleted the noncopyable-serialization branch December 13, 2023 18:57
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