You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Distributed] Handle SerializationRequirement in dist get props
- reuse more code about getting the type and requirements
- handle protocols properly, including extensions with where clauses
- improve error messages
Copy file name to clipboardExpand all lines: test/Distributed/distributed_actor_inference.swift
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -58,12 +58,12 @@ distributed actor SomeDistributedActor_6 {
58
58
}
59
59
60
60
distributedactorBadValuesDistributedActor_7{
61
-
distributedvarvarItNope:Int{13} // expected-error{{'distributed' modifier cannot be applied to this declaration}}
62
-
distributedletletItNope:Int=13 // expected-error{{'distributed' modifier cannot be applied to this declaration}}
63
-
distributed lazy varlazyVarNope:Int=13 // expected-error{{'distributed' modifier cannot be applied to this declaration}}
61
+
distributedvarvarItNope:Int{13} // we allow these
62
+
distributedletletItNope:Int=13 // expected-error{{static property 'letItNope' cannot be 'distributed', because it is not a computed get-only property}}
63
+
distributed lazy varlazyVarNope:Int=13 // expected-error{{'distributed' computed property 'lazyVarNope' can only be have a 'get' implementation}}
64
64
distributed subscript(nope:Int)->Int{ nope *2} // expected-error{{'distributed' modifier cannot be applied to this declaration}}
65
-
distributedstaticletstaticLetNope:Int=13 // expected-error{{'distributed' modifier cannot be applied to this declaration}}
66
-
distributedstaticvarstaticVarNope:Int{13} // expected-error{{'distributed' modifier cannot be applied to this declaration}}
65
+
distributedstaticletstaticLetNope:Int=13 // expected-error{{'distributed' property 'staticLetNope' cannot be 'static'}}
66
+
distributedstaticvarstaticVarNope:Int{13} // expected-error{{'distributed' property 'staticVarNope' cannot be 'static'}}
67
67
distributedstaticfunc staticNope()asyncthrows->Int{13} // expected-error{{'distributed' method cannot be 'static'}}
Copy file name to clipboardExpand all lines: test/Distributed/distributed_actor_isolation.swift
+11-14Lines changed: 11 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -28,8 +28,8 @@ struct NotCodableValue { }
28
28
29
29
distributedactorDistributedActor_1{
30
30
31
-
letname:String="alice" // expected-note{{distributed actor state is only available within the actor instance}}
32
-
varmutable:String="alice" // expected-note{{distributed actor state is only available within the actor instance}}
31
+
letname:String="alice" // expected-note{{access to this property is only permitted within the distributed actor 'DistributedActor_1'}}
32
+
varmutable:String="alice" // expected-note{{access to this property is only permitted within the distributed actor 'DistributedActor_1'}}
33
33
varcomputedMutable:String{
34
34
get{
35
35
"hey"
@@ -39,11 +39,8 @@ distributed actor DistributedActor_1 {
39
39
}
40
40
}
41
41
42
-
distributedletletProperty:String="" // expected-error{{'distributed' modifier cannot be applied to this declaration}}
43
-
distributedvarvarProperty:String="" // expected-error{{'distributed' modifier cannot be applied to this declaration}}
44
-
distributedvarcomputedProperty:String{ // expected-error{{'distributed' modifier cannot be applied to this declaration}}
45
-
""
46
-
}
42
+
distributedletletProperty:String="" // expected-error{{static property 'letProperty' cannot be 'distributed', because it is not a computed get-only property}}
43
+
distributedvarvarProperty:String="" // expected-error{{'distributed' computed property 'varProperty' can only be have a 'get' implementation}}
47
44
48
45
distributedstaticfunc distributedStatic(){} // expected-error{{'distributed' method cannot be 'static'}}
49
46
distributedclassfunc distributedClass(){}
@@ -64,10 +61,10 @@ distributed actor DistributedActor_1 {
64
61
distributedfunc distIntString(int:Int, two:String)asyncthrows->(String){"\(int) + \(two)"} // ok
// expected-error@-1 {{parameter 'notCodable' of type 'NotCodableValue' in distributed instance method does not conform to 'Codable'}}
64
+
// expected-error@-1 {{parameter 'notCodable' of type 'NotCodableValue' in distributed instance method does not conform to serialization requirement 'Codable'}}
// expected-error@-1 {{result type 'NotCodableValue' of distributed instance method does not conform to 'Codable'}}
67
+
// expected-error@-1 {{result type 'NotCodableValue' of distributed instance method 'distBadReturn' does not conform to serialization requirement 'Codable'}}
71
68
fatalError()
72
69
}
73
70
@@ -76,7 +73,7 @@ distributed actor DistributedActor_1 {
76
73
}
77
74
78
75
distributedfunc closure(close:()->String){
79
-
// expected-error@-1{{parameter 'close' of type '() -> String' in distributed instance method does not conform to 'Codable'}}
76
+
// expected-error@-1{{parameter 'close' of type '() -> String' in distributed instance method does not conform to serialization requirement 'Codable'}}
0 commit comments