[Module interfaces] More aggressively #if-out declarations.

Extend the checks for marker protocols and rethrows protocols to ensure
that we #if out more code that relies on them in module interface
generation. This makes the _Concurrency module parseable by much older
compilers.

Fixes rdar://75291705.
This commit is contained in:
Doug Gregor
2021-03-11 21:58:56 -08:00
parent f1218fcc01
commit 7015543c9c
3 changed files with 96 additions and 20 deletions

View File

@@ -550,11 +550,11 @@ public:
if (!handledProtocols.insert(inherited).second)
return TypeWalker::Action::SkipChildren;
// If 'nominal' is an 'actor class', we do not synthesize its
// conformance to the Actor protocol through a dummy extension.
// If 'nominal' is an actor, we do not synthesize its conformance
// to the Actor protocol through a dummy extension.
// There is a special restriction on the Actor protocol in that
// it is only valid to conform to Actor on an 'actor class' decl,
// not extensions of that 'actor class'.
// it is only valid to conform to Actor on an 'actor' decl,
// not extensions of that 'actor'.
if (actorClass &&
inherited->isSpecificProtocol(KnownProtocolKind::Actor))
return TypeWalker::Action::SkipChildren;