File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,38 @@ CHANGELOG
26
26
Swift Next
27
27
----------
28
28
29
+ * [ SR-11429] [ ] :
30
+
31
+ The compiler will now correctly strip argument labels from function references
32
+ used with the ` as ` operator in a function call. As a result, the ` as ` operator
33
+ can now be used to disambiguate a call to a function with argument labels.
34
+
35
+ ``` swift
36
+ func foo (x : Int ) {}
37
+ func foo (x : UInt ) {}
38
+
39
+ (foo as (Int ) -> Void )(5 ) // Calls foo(x: Int)
40
+ (foo as (UInt ) -> Void )(5 ) // Calls foo(x: UInt)
41
+ ```
42
+
43
+ Previously this was only possible for functions without argument labels.
44
+
45
+ This change also means that a generic type alias can no longer be used to
46
+ preserve the argument labels of a function reference through the ` as `
47
+ operator. The following is now rejected:
48
+
49
+ ``` swift
50
+ typealias Magic <T > = T
51
+ func foo (x : Int ) {}
52
+ (foo as Magic)(x : 5 ) // error: Extraneous argument label 'x:' in call
53
+ ```
54
+
55
+ The function value must instead be called without argument labels:
56
+
57
+ ``` swift
58
+ (foo as Magic)(5 )
59
+ ```
60
+
29
61
* [ SR-11298] [ ] :
30
62
31
63
A class-constrained protocol extension, where the extended protocol does
@@ -7825,3 +7857,4 @@ Swift 1.0
7825
7857
[SR- 9043 ]: < https: // bugs.swift.org/browse/SR-9043>
7826
7858
[SR- 9827 ]: < https: // bugs.swift.org/browse/SR-9827>
7827
7859
[SR- 11298 ]: < https: // bugs.swift.org/browse/SR-11298>
7860
+ [SR- 11429 ]: < https: // bugs.swift.org/browse/SR-11429>
You can’t perform that action at this time.
0 commit comments