Closed
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