@@ -6578,36 +6578,6 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
6578
6578
})),
6579
6579
" transferring result means all results are transferring" );
6580
6580
6581
- // We should only ever have a single sil_isolated parameter.
6582
- bool foundIsolatedParameter = false ;
6583
- for (const auto ¶meterInfo : FTy->getParameters ()) {
6584
- if (parameterInfo.hasOption (SILParameterInfo::Isolated)) {
6585
- auto argType = parameterInfo.getArgumentType (F.getModule (),
6586
- FTy,
6587
- F.getTypeExpansionContext ());
6588
- if (argType->isOptional ())
6589
- argType = argType->lookThroughAllOptionalTypes ()->getCanonicalType ();
6590
-
6591
- auto genericSig = FTy->getInvocationGenericSignature ();
6592
- auto &ctx = F.getASTContext ();
6593
- auto *actorProtocol = ctx.getProtocol (KnownProtocolKind::Actor);
6594
- auto *anyActorProtocol = ctx.getProtocol (KnownProtocolKind::AnyActor);
6595
- bool genericTypeWithActorRequirement = llvm::any_of (
6596
- genericSig.getRequirements (), [&](const Requirement &other) {
6597
- if (other.getKind () != RequirementKind::Conformance)
6598
- return false ;
6599
- if (other.getFirstType ()->getCanonicalType () != argType)
6600
- return false ;
6601
- auto *otherProtocol = other.getProtocolDecl ();
6602
- return otherProtocol->inheritsFrom (actorProtocol) ||
6603
- otherProtocol->inheritsFrom (anyActorProtocol);
6604
- });
6605
- require (argType->isAnyActorType () || genericTypeWithActorRequirement,
6606
- " Only any actor types can be isolated" );
6607
- require (!foundIsolatedParameter, " Two isolated parameters" );
6608
- foundIsolatedParameter = true ;
6609
- }
6610
- }
6611
6581
require (1 >= std::count_if (FTy->getParameters ().begin (), FTy->getParameters ().end (),
6612
6582
[](const SILParameterInfo ¶meterInfo) {
6613
6583
return parameterInfo.hasOption (SILParameterInfo::Isolated);
@@ -7015,11 +6985,37 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
7015
6985
}
7016
6986
}
7017
6987
6988
+ void verifyParentFunctionSILFunctionType (CanSILFunctionType FTy) {
6989
+ bool foundIsolatedParameter = false ;
6990
+ for (const auto ¶meterInfo : FTy->getParameters ()) {
6991
+ if (parameterInfo.hasOption (SILParameterInfo::Isolated)) {
6992
+ auto argType = parameterInfo.getArgumentType (F.getModule (),
6993
+ FTy,
6994
+ F.getTypeExpansionContext ());
6995
+
6996
+ if (argType->isOptional ())
6997
+ argType = argType->lookThroughAllOptionalTypes ()->getCanonicalType ();
6998
+
6999
+ auto genericSig = FTy->getInvocationGenericSignature ();
7000
+ auto &ctx = F.getASTContext ();
7001
+ auto *actorProtocol = ctx.getProtocol (KnownProtocolKind::Actor);
7002
+ auto *anyActorProtocol = ctx.getProtocol (KnownProtocolKind::AnyActor);
7003
+ require (argType->isAnyActorType () ||
7004
+ genericSig->requiresProtocol (argType, actorProtocol) ||
7005
+ genericSig->requiresProtocol (argType, anyActorProtocol),
7006
+ " Only any actor types can be isolated" );
7007
+ require (!foundIsolatedParameter, " Two isolated parameters" );
7008
+ foundIsolatedParameter = true ;
7009
+ }
7010
+ }
7011
+ }
7012
+
7018
7013
void visitSILFunction (SILFunction *F) {
7019
7014
PrettyStackTraceSILFunction stackTrace (" verifying" , F);
7020
7015
7021
7016
CanSILFunctionType FTy = F->getLoweredFunctionType ();
7022
7017
verifySILFunctionType (FTy);
7018
+ verifyParentFunctionSILFunctionType (FTy);
7023
7019
7024
7020
SILModule &mod = F->getModule ();
7025
7021
bool embedded = mod.getASTContext ().LangOpts .hasFeature (Feature::Embedded);
0 commit comments