mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Distributed] Handle distributed func witnessess from distributed actor protocols (#38269)
* [Distributed] Handle distributed func witnessess from distributed actor protocols * [Distributed] Implement dist protocol and nonisolated handling * revert additional warning check * [Distributed] Ban mixing nonisolated and distributed on func * [Distributed] handle nonisolated in distributed contexts
This commit is contained in:
committed by
GitHub
parent
5a13cc0f64
commit
ae9e320215
30
test/Distributed/distributed_actor_basic.swift
Normal file
30
test/Distributed/distributed_actor_basic.swift
Normal file
@@ -0,0 +1,30 @@
|
||||
// RUN: %target-typecheck-verify-swift -enable-experimental-distributed
|
||||
// REQUIRES: concurrency
|
||||
// REQUIRES: distributed
|
||||
|
||||
import _Distributed
|
||||
|
||||
@available(SwiftStdlib 5.5, *)
|
||||
distributed struct StructNope {} // expected-error{{distributed' modifier cannot be applied to this declaration}}
|
||||
@available(SwiftStdlib 5.5, *)
|
||||
distributed class ClassNope {} // expected-error{{'distributed' can only be applied to 'actor' definitions, and distributed actor-isolated async functions}}
|
||||
@available(SwiftStdlib 5.5, *)
|
||||
distributed enum EnumNope {} // expected-error{{distributed' modifier cannot be applied to this declaration}}
|
||||
|
||||
@available(SwiftStdlib 5.5, *)
|
||||
distributed actor DA {
|
||||
|
||||
class func classFunc() {
|
||||
// expected-error@-1{{class methods are only allowed within classes; use 'static' to declare a static method}}
|
||||
}
|
||||
|
||||
nonisolated distributed func nonisolatedDistributed() async {
|
||||
// expected-error@-1{{function 'nonisolatedDistributed()' cannot be both 'nonisolated' and 'distributed'}}{{3-15=}}
|
||||
fatalError()
|
||||
}
|
||||
|
||||
distributed nonisolated func distributedNonisolated() async {
|
||||
// expected-error@-1{{function 'distributedNonisolated()' cannot be both 'nonisolated' and 'distributed'}}{{15-27=}}
|
||||
fatalError()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user