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
[Concurrency] Make actor-isolated protocol witnesses an error.
With actor isolation checking for protocol witnesses moved out of the
witness-matching phase, move the corresponding diagnostics from notes
(that would have been on the "type does not conform" error) to
freestanding errors.
// FIXME: "Do you want to add a stub?" diagnostics should be suppressed here.
16
15
protocolSyncProtocol{
17
16
varpropertyA:Int{get}
18
-
// expected-note@-1{{do you want to add a stub}}
19
17
varpropertyB:Int{getset}
20
-
// expected-note@-1{{do you want to add a stub}}
21
18
22
19
func syncMethodA()
23
-
// expected-note@-1{{do you want to add a stub}}
24
20
25
21
func syncMethodB()
26
22
27
23
func syncMethodC()->Int
28
24
29
25
subscript (index:Int)->String{get}
30
-
// expected-note@-1{{do you want to add a stub}}
31
26
32
27
staticfunc staticMethod()
33
28
staticvarstaticProperty:Int{get}
34
29
}
35
30
36
31
37
-
actorclass OtherActor:SyncProtocol{ // expected-error{{type 'OtherActor' does not conform to protocol 'SyncProtocol'}}
32
+
actorclass OtherActor:SyncProtocol{
38
33
varpropertyB:Int=17
39
-
// expected-note@-1{{actor-isolated property 'propertyB' cannot be used to satisfy a protocol requirement}}
34
+
// expected-error@-1{{actor-isolated property 'propertyB' cannot be used to satisfy a protocol requirement}}
40
35
41
36
varpropertyA:Int{17}
42
-
// expected-note@-1{{actor-isolated property 'propertyA' cannot be used to satisfy a protocol requirement}}
37
+
// expected-error@-1{{actor-isolated property 'propertyA' cannot be used to satisfy a protocol requirement}}
43
38
44
39
func syncMethodA(){}
45
-
// expected-note@-1{{actor-isolated instance method 'syncMethodA()' cannot be used to satisfy a protocol requirement; did you mean to make it an asychronous handler?}}{{3-3=@asyncHandler }}
40
+
// expected-error@-1{{actor-isolated instance method 'syncMethodA()' cannot be used to satisfy a protocol requirement; did you mean to make it an asychronous handler?}}{{3-3=@asyncHandler }}
46
41
47
42
// Async handlers are okay.
48
43
@asyncHandler
@@ -53,7 +48,7 @@ actor class OtherActor: SyncProtocol { // expected-error{{type 'OtherActor' does
53
48
@actorIndependentfunc syncMethodC()->Int{5}
54
49
55
50
subscript (index:Int)->String{"\(index)"}
56
-
// expected-note@-1{{actor-isolated subscript 'subscript(_:)' cannot be used to satisfy a protocol requirement}}
51
+
// expected-error@-1{{actor-isolated subscript 'subscript(_:)' cannot be used to satisfy a protocol requirement}}
Copy file name to clipboardExpand all lines: test/decl/protocol/special/Actor.swift
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,7 @@ class C1: Actor {
42
42
43
43
// Method that is not usable as a witness.
44
44
actorclass BA1 {
45
-
func enqueue(partialTask:PartialAsyncTask){} // expected-note{{actor-isolated instance method 'enqueue(partialTask:)' cannot be used to satisfy a protocol requirement; did you mean to make it an asychronous handler?}}
45
+
func enqueue(partialTask:PartialAsyncTask){} // expected-error{{actor-isolated instance method 'enqueue(partialTask:)' cannot be used to satisfy a protocol requirement; did you mean to make it an asychronous handler?}}
46
46
}
47
47
48
48
// Method that isn't part of the main class definition cannot be used to
0 commit comments