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
Copy file name to clipboardExpand all lines: CHANGELOG.md
+17-6Lines changed: 17 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -177,22 +177,33 @@ _**Note:** This is in reverse chronological order, so newer entries are added to
177
177
For example, this allows writing down the types `some Collection<Int>` and
178
178
`any Collection<Int>`.
179
179
180
-
* References to `optional` methods on a protocol metatype, as well as references to dynamically looked up methods on the `AnyObject`metatype are now supported. These references always have the type of a function that accepts a single argument and returns an optional value of function type:
180
+
* References to `optional` methods on a protocol metatype, as well as references to dynamically looked up methods on `AnyObject` are now supported on par with other function references. The type of such a reference (formerly an immediate optional by mistake) has been altered to that of a function that takes a single argument and returns an optional value of function type:
181
181
182
182
```swift
183
183
classObject {
184
-
@objcfuncgetTag() ->Int
184
+
@objcfuncgetTag() ->Int { ... }
185
185
}
186
186
187
-
@objcprotocolP {
187
+
let getTag: (AnyObject) -> (() ->Int)?=AnyObject.getTag
188
+
189
+
@objcprotocolDelegate {
188
190
@objcoptionalfuncdidUpdateObject(withTagtag: Int)
189
191
}
190
192
191
-
let getTag: (AnyObject) -> (() ->Int)?=AnyObject.getTag
192
-
193
-
let didUpdateObject: (any P) -> ((Int) ->Void)?= P.didUpdateObject
193
+
let didUpdateObjectWithTag: (Delegate) -> ((Int) ->Void)?= Delegate.didUpdateObject
194
194
```
195
195
196
+
> **Warning**
197
+
> Due to the type change, selectors for aforementioned method references that require writing out their type explicitly for disambiguation will no longer compile. To fix this, simply adjust the written type, or resort to a `#if swift(<5.7)` directive when compatibility with older compiler versions is warranted. For example:
0 commit comments