@@ -683,31 +683,6 @@ static bool isSendableClosure(
683
683
return false;
684
684
}
685
685
686
- /// Determine whether the given type is suitable as a concurrent value type.
687
- bool swift::isSendableType(ModuleDecl *module, Type type) {
688
- auto proto = module->getASTContext().getProtocol(KnownProtocolKind::Sendable);
689
- if (!proto)
690
- return true;
691
-
692
- // First check if we have a function type. If we do, check if it is
693
- // Sendable. We do this since functions cannot conform to protocols.
694
- if (auto *fas = type->getAs<SILFunctionType>())
695
- return fas->isSendable();
696
- if (auto *fas = type->getAs<AnyFunctionType>())
697
- return fas->isSendable();
698
-
699
- auto conformance = module->checkConformance(type, proto);
700
- if (conformance.isInvalid())
701
- return false;
702
-
703
- // Look for missing Sendable conformances.
704
- return !conformance.forEachMissingConformance(
705
- [](BuiltinProtocolConformance *missing) {
706
- return missing->getProtocol()->isSpecificProtocol(
707
- KnownProtocolKind::Sendable);
708
- });
709
- }
710
-
711
686
/// Add Fix-It text for the given nominal type to adopt Sendable.
712
687
static void addSendableFixIt(
713
688
const NominalTypeDecl *nominal, InFlightDiagnostic &diag, bool unchecked) {
@@ -4741,8 +4716,7 @@ ActorIsolation ActorIsolationRequest::evaluate(
4741
4716
diagVar = originalVar;
4742
4717
}
4743
4718
if (var->isLet()) {
4744
- if (!isSendableType(var->getModuleContext(),
4745
- var->getInterfaceType())) {
4719
+ if (!var->getInterfaceType()->isSendableType()) {
4746
4720
diagVar->diagnose(diag::shared_immutable_state_decl, diagVar)
4747
4721
.warnUntilSwiftVersion(6);
4748
4722
}
@@ -6356,7 +6330,7 @@ ActorReferenceResult ActorReferenceResult::forReference(
6356
6330
(!actorInstance || actorInstance->isSelf())) {
6357
6331
auto type =
6358
6332
fromDC->mapTypeIntoContext(declRef.getDecl()->getInterfaceType());
6359
- if (!isSendableType(fromDC->getParentModule(), type )) {
6333
+ if (!type->isSendableType( )) {
6360
6334
// Treat the decl isolation as 'preconcurrency' to downgrade violations
6361
6335
// to warnings, because violating Sendable here is accepted by the
6362
6336
// Swift 5.9 compiler.
0 commit comments