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