[SE-0466] Don't infer @MainActor on types conforming to Sendable

When the default isolation is main-actor, don't infer @MainActor
for a type that conforms to a protocol P in its primary definition when
P inherits from Sendable. Such types should remain non-isolated
because they're highly unlikely to be able to implement the P
conformance (which cannot be isolated).

Put this feature behind a new experimental flag,
SendableProhibitsMainActorInference.

Implements rdar://151029300
This commit is contained in:
Doug Gregor
2025-05-12 22:22:25 -07:00
parent 5552d37668
commit ee9f6f8db7
4 changed files with 90 additions and 14 deletions

View File

@@ -125,6 +125,7 @@ UNINTERESTING_FEATURE(StructLetDestructuring)
UNINTERESTING_FEATURE(MacrosOnImports)
UNINTERESTING_FEATURE(NonisolatedNonsendingByDefault)
UNINTERESTING_FEATURE(KeyPathWithMethodMembers)
UNINTERESTING_FEATURE(SendableProhibitsMainActorInference)
// TODO: Return true for inlinable function bodies with module selectors in them
UNINTERESTING_FEATURE(ModuleSelector)