mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Distributed] distributed func checks now work in protocols & dont crash
This commit is contained in:
@@ -29,6 +29,41 @@ distributed actor SpecifyRequirement: NoSerializationRequirementYet {
|
||||
distributed func testAT() async throws -> NotCodable {
|
||||
.init()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protocol ProtocolWithChecksSystem: DistributedActor
|
||||
where ActorSystem == FakeActorSystem {
|
||||
// expected-error@+1{{result type 'NotCodable' of distributed instance method 'testAT' does not conform to serialization requirement 'Codable'}}
|
||||
distributed func testAT() async throws -> NotCodable
|
||||
}
|
||||
distributed actor ProtocolWithChecksSystemDA: ProtocolWithChecksSystem {
|
||||
// expected-error@+1{{result type 'NotCodable' of distributed instance method 'testAT' does not conform to serialization requirement 'Codable'}}
|
||||
distributed func testAT() async throws -> NotCodable { .init() }
|
||||
}
|
||||
|
||||
protocol ProtocolWithChecksSeqReq: DistributedActor
|
||||
where Self.SerializationRequirement == Codable {
|
||||
// expected-error@+1{{result type 'NotCodable' of distributed instance method 'testAT' does not conform to serialization requirement 'Codable'}}
|
||||
distributed func testAT() async throws -> NotCodable
|
||||
}
|
||||
distributed actor ProtocolWithChecksSeqReqDA_MissingSystem: ProtocolWithChecksSeqReq {
|
||||
// expected-error@-1{{distributed actor 'ProtocolWithChecksSeqReqDA_MissingSystem' does not declare ActorSystem it can be used with.}}
|
||||
// expected-note@-2{{you can provide a module-wide default actor system by declaring:}}
|
||||
// expected-error@-3{{type 'ProtocolWithChecksSeqReqDA_MissingSystem' does not conform to protocol 'ProtocolWithChecksSeqReq'}}
|
||||
//
|
||||
// expected-error@-5{{distributed actor 'ProtocolWithChecksSeqReqDA_MissingSystem' does not declare ActorSystem it can be used with.}}
|
||||
|
||||
// Entire conformance is doomed, so we didn't proceed to checking the functions; that's fine
|
||||
distributed func testAT() async throws -> NotCodable { .init() }
|
||||
}
|
||||
|
||||
distributed actor ProtocolWithChecksSeqReqDA: ProtocolWithChecksSeqReq {
|
||||
typealias ActorSystem = FakeActorSystem
|
||||
// ok, since FakeActorSystem.SerializationRequirement == ProtocolWithChecksSeqReq.SerializationRequirement
|
||||
|
||||
// expected-error@+1{{result type 'NotCodable' of distributed instance method 'testAT' does not conform to serialization requirement 'Codable'}}
|
||||
distributed func testAT() async throws -> NotCodable { .init() }
|
||||
}
|
||||
|
||||
extension NoSerializationRequirementYet {
|
||||
|
||||
Reference in New Issue
Block a user