-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Closed
Copy link
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.concurrencyFeature: umbrella label for concurrency language featuresFeature: umbrella label for concurrency language featuresconformancesFeature → protocol: protocol conformancesFeature → protocol: protocol conformancesdeclarationsFeature: declarationsFeature: declarationstype checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis
Description
Description
I thought for sure this was going to work, but somewhat similar to #76677, it doesn't look like the sending
is being taken into account here. The Sendability of the return type should not matter in this case, should it?
Reproduction
final class DataModel {
let name: String
init(name: String) {
self.name = name
}
}
protocol DataStoring {
func loadModel() async -> sending DataModel
}
@MainActor
final class DataStore: DataStoring {
func loadModel() async -> sending DataModel {
// error: non-sendable type 'DataModel' returned by main actor-isolated instance method 'loadModel()' satisfying protocol requirement cannot cross actor boundary
DataModel(name: "foo")
}
}
Expected behavior
I'd expect this to compile without error.
Environment
Apple Swift version 6.0.2-dev (LLVM 43d73cb0cc589f7, Swift aaa632c)
Target: arm64-apple-macosx14.0
Additional information
No response
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.concurrencyFeature: umbrella label for concurrency language featuresFeature: umbrella label for concurrency language featuresconformancesFeature → protocol: protocol conformancesFeature → protocol: protocol conformancesdeclarationsFeature: declarationsFeature: declarationstype checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis