-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Open
Labels
actorFeature → concurrency: `actor` declarationsFeature → concurrency: `actor` declarationscompilerThe Swift compiler itselfThe Swift compiler itselfconcurrencyFeature: umbrella label for concurrency language featuresFeature: umbrella label for concurrency language featuresnonisolated(nonsending)Feature → modifiers: The "nonisolated(nonsending)" modifierFeature → modifiers: The "nonisolated(nonsending)" modifierswift 6.3type checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysisunexpected behaviorBug: Unexpected behavior or incorrect outputBug: Unexpected behavior or incorrect output
Description
Description
nonisolated(nonsending) is synonymous to nonisolated when NonisolatedNonsendingByDefault is enabled. However, when considering the implicit isolation of an associated protocol requirement for the purpose of inferring the isolation of a method, isolation inference treats them differently. Implicit nonisolated (modelled as "unspecified" isolation) loses to a global-actor-isolated type context, whereas implicit nonisolated(nonsending) wins.
Reproduction
// -enable-upcoming-feature NonisolatedNonsendingByDefault
protocol P {
/*nonisolated(nonsending)*/ func foo() async
}
@MainActor struct S: P {
/*nonisolated(nonsending)*/ func foo() async {}
}protocol P {
/*nonisolated*/ func foo() async
}
@MainActor struct S: P {
/*@MainActor*/ func foo() async {}
}Expected behavior
@MainActor wins in both cases.
Environment
Swift version 6.3-dev (520471c)
Additional information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
actorFeature → concurrency: `actor` declarationsFeature → concurrency: `actor` declarationscompilerThe Swift compiler itselfThe Swift compiler itselfconcurrencyFeature: umbrella label for concurrency language featuresFeature: umbrella label for concurrency language featuresnonisolated(nonsending)Feature → modifiers: The "nonisolated(nonsending)" modifierFeature → modifiers: The "nonisolated(nonsending)" modifierswift 6.3type checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysisunexpected behaviorBug: Unexpected behavior or incorrect outputBug: Unexpected behavior or incorrect output