A @_distributedActorIndependent declaration is nonisolated.

The `@__distributedActorIndependent` attribute is effectively the same
as nonisolated, so start treating it that way by making actor-isolation
checking look for it specifically and conclude "nonisolated". Remove
various special cases for this attribute that don't need to exist.
This commit is contained in:
Doug Gregor
2021-10-01 22:37:54 -07:00
parent 7e2469fe87
commit d04fff6f12
5 changed files with 38 additions and 71 deletions

View File

@@ -67,24 +67,24 @@ distributed actor DistributedActor_1 {
fatalError()
}
distributed func distReturnGeneric<T: Codable>(item: T) async throws -> T { // ok
distributed func distReturnGeneric<T: Codable & Sendable>(item: T) async throws -> T { // ok
item
}
distributed func distReturnGenericWhere<T>(item: Int) async throws -> T where T: Codable { // ok
distributed func distReturnGenericWhere<T: Sendable>(item: Int) async throws -> T where T: Codable { // ok
fatalError()
}
distributed func distBadReturnGeneric<T>(int: Int) async throws -> T {
distributed func distBadReturnGeneric<T: Sendable>(int: Int) async throws -> T {
// expected-error@-1 {{distributed function result type 'T' does not conform to 'Codable'}}
fatalError()
}
distributed func distGenericParam<T: Codable>(value: T) async throws { // ok
distributed func distGenericParam<T: Codable & Sendable>(value: T) async throws { // ok
fatalError()
}
distributed func distGenericParamWhere<T>(value: T) async throws -> T where T: Codable { // ok
distributed func distGenericParamWhere<T: Sendable>(value: T) async throws -> T where T: Codable { // ok
value
}
distributed func distBadGenericParam<T>(int: T) async throws {
distributed func distBadGenericParam<T: Sendable>(int: T) async throws {
// expected-error@-1 {{distributed function parameter 'int' of type 'T' does not conform to 'Codable'}}
fatalError()
}