@@ -16,25 +16,34 @@ distributed actor Overloader {
16
16
func overloaded( ) { }
17
17
func overloaded( ) async { }
18
18
19
- distributed func overloadedDistA( ) { } // expected-note {{ambiguous distributed func 'overloadedDistA()' declared here }}
20
- distributed func overloadedDistA( ) async { } // expected-error {{ambiguous distributed func declaration 'overloadedDistA()', cannot overload distributed methods on effect only }}
19
+ distributed func overloadedDistA( ) { } // expected-error {{ambiguous distributed func declaration 'overloadedDistA()', cannot overload distributed methods on effect only }}
20
+ distributed func overloadedDistA( ) async { } // expected-note {{ambiguous distributed func 'overloadedDistA()' declared here }}
21
21
22
- distributed func overloadedDistT( ) throws { } // expected-note {{ambiguous distributed func 'overloadedDistT()' declared here }}
23
- distributed func overloadedDistT( ) async throws { } // expected-error {{ambiguous distributed func declaration 'overloadedDistT()', cannot overload distributed methods on effect only }}
22
+ distributed func overloadedDistT( ) throws { } // expected-error {{ambiguous distributed func declaration 'overloadedDistT()', cannot overload distributed methods on effect only }}
23
+ distributed func overloadedDistT( ) async throws { } // expected-note {{ambiguous distributed func 'overloadedDistT()' declared here }}
24
24
25
25
// Throws overloads are not legal anyway, but let's check for them here too:
26
26
distributed func overloadedDistThrows( ) { }
27
- // expected-note@-1{{ambiguous distributed func 'overloadedDistThrows()' declared here}}
28
- // expected-note @-2{{'overloadedDistThrows()' previously declared here }}
27
+ // expected-note@-1{{'overloadedDistThrows()' previously declared here}}
28
+ // expected-error @-2{{ambiguous distributed func declaration 'overloadedDistThrows()', cannot overload distributed methods on effect only }}
29
29
distributed func overloadedDistThrows( ) throws { }
30
- // expected-error@-1{{ambiguous distributed func declaration 'overloadedDistThrows()', cannot overload distributed methods on effect only }}
31
- // expected-error @-2{{invalid redeclaration of 'overloadedDistThrows()'}}
30
+ // expected-error@-1{{invalid redeclaration of 'overloadedDistThrows()'}}
31
+ // expected-note @-2{{ambiguous distributed func 'overloadedDistThrows()' declared here }}
32
32
33
33
distributed func overloadedDistAsync( ) async { }
34
- // expected-note@-1{{ambiguous distributed func 'overloadedDistAsync()' declared here}}
35
- // expected-note @-2{{'overloadedDistAsync()' previously declared here }}
34
+ // expected-note@-1{{'overloadedDistAsync()' previously declared here}}
35
+ // expected-error @-2{{ambiguous distributed func declaration 'overloadedDistAsync()', cannot overload distributed methods on effect only }}
36
36
distributed func overloadedDistAsync( ) async throws { }
37
- // expected-error@-1{{ambiguous distributed func declaration 'overloadedDistAsync()', cannot overload distributed methods on effect only}}
38
- // expected-error@-2{{invalid redeclaration of 'overloadedDistAsync()'}}
37
+ // expected-error@-1{{invalid redeclaration of 'overloadedDistAsync()'}}
38
+ // expected-note@-2{{ambiguous distributed func 'overloadedDistAsync()' declared here}}
39
+
40
+ // overloads differing by parameter type are allowed,
41
+ // since the mangled identifier includes full type information:
42
+ distributed func overloadedDistParams( param: String ) async { }
43
+ distributed func overloadedDistParams( param: Int ) async { }
44
+
45
+ distributed func overloadedDistParams( ) async { } // also ok
46
+
47
+ distributed func overloadedDistParams< A: Sendable & Codable > ( param: A ) async { }
39
48
}
40
49
0 commit comments