It seems in the latest version of 5.5, marking a function as Sendable only applies to value types and reference types declared as var
. This compiles:
class Person {
var name = ""
}
func doStuff(_ block: (@Sendable () async throws -> Void)) async throws {
try await block()
}
func main() async throws {
let person = Person()
try await doStuff {
person.name = "Jon"
}
}
But I would assume it should not? Is this the intended behaviour or has this not been implemented yet?