@@ -22,6 +22,12 @@ protocol SyncProtocol {
22
22
23
23
func syncMethodC( ) -> Int
24
24
25
+ func syncMethodE( ) -> Void // expected-note{{mark the protocol requirement 'syncMethodE()' 'async' to allow actor-isolated conformances}}{{21-21= async}}
26
+
27
+ func syncMethodF( param: String ) -> Int // expected-note{{mark the protocol requirement 'syncMethodF(param:)' 'async' to allow actor-isolated conformances}}{{34-34= async}}
28
+
29
+ func syncMethodG( ) throws -> Void // expected-note{{mark the protocol requirement 'syncMethodG()' 'async' to allow actor-isolated conformances}}{{22-22=async }}
30
+
25
31
subscript ( index: Int ) -> String { get } // expected-note{{'subscript(_:)' declared here}}
26
32
27
33
static func staticMethod( )
@@ -44,6 +50,18 @@ actor OtherActor: SyncProtocol {
44
50
// FIXME: Consider suggesting nonisolated if this didn't match.
45
51
nonisolated func syncMethodC( ) -> Int { 5 }
46
52
53
+ func syncMethodE( ) -> Void { }
54
+ // expected-error@-1{{actor-isolated instance method 'syncMethodE()' cannot be used to satisfy nonisolated protocol requirement}}
55
+ // expected-note@-2{{add 'nonisolated' to 'syncMethodE()' to make this instance method not isolated to the actor}}{{3-3=nonisolated }}
56
+
57
+ func syncMethodF( param: String ) -> Int { 5 }
58
+ // expected-error@-1{{actor-isolated instance method 'syncMethodF(param:)' cannot be used to satisfy nonisolated protocol requirement}}
59
+ // expected-note@-2{{add 'nonisolated' to 'syncMethodF(param:)' to make this instance method not isolated to the actor}}{{3-3=nonisolated }}
60
+
61
+ func syncMethodG( ) { }
62
+ // expected-error@-1{{actor-isolated instance method 'syncMethodG()' cannot be used to satisfy nonisolated protocol requirement}}
63
+ // expected-note@-2{{add 'nonisolated' to 'syncMethodG()' to make this instance method not isolated to the actor}}{{3-3=nonisolated }}
64
+
47
65
subscript ( index: Int ) -> String { " \( index) " }
48
66
// expected-error@-1{{actor-isolated subscript 'subscript(_:)' cannot be used to satisfy nonisolated protocol requirement}}
49
67
// expected-note@-2{{add 'nonisolated' to 'subscript(_:)' to make this subscript not isolated to the actor}}{{3-3=nonisolated }}
@@ -77,4 +95,4 @@ actor A2: Initializers {
77
95
init ( int: Int ) { }
78
96
79
97
func withBells( ) async -> A2 { self }
80
- }
98
+ }
0 commit comments