[NCGenerics] only print ~Copyable in interface

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.
This commit is contained in:
Kavon Farvardin
2023-12-05 12:21:58 -08:00
parent ffc06f9d31
commit bd1330715c
7 changed files with 376 additions and 83 deletions

View File

@@ -704,6 +704,13 @@ public:
inherited->isSpecificProtocol(KnownProtocolKind::Actor))
return TypeWalker::Action::SkipChildren;
// Do not synthesize an extension to print a conformance to an
// invertible protocol, as their conformances are always re-inferred
// using the interface itself.
if (auto kp = inherited->getKnownProtocolKind())
if (getInvertibleProtocolKind(*kp))
return TypeWalker::Action::SkipChildren;
if (inherited->isSPI() && printOptions.printPublicInterface())
return TypeWalker::Action::Continue;