Skip to content

Commit 8d009ae

Browse files
authored
Merge pull request #2613 from spevans/pr_sr_8918
SR-8918: warning: conditional cast from 'Any' to 'AnyObject' always succeeds
2 parents 12e60f6 + b7d606c commit 8d009ae

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

Foundation/UserDefaults.swift

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,8 @@ private var registeredDefaults = [String: Any]()
1313
private var sharedDefaults = UserDefaults()
1414

1515
fileprivate func bridgeFromNSCFTypeIfNeeded(_ value: Any) -> Any {
16-
// This line will produce a 'Conditional cast always succeeds' warning if compiled on Darwin, since Darwin has bridging casts of any value to an object,
17-
// but is required for non-Darwin to work correctly, since that platform _doesn't_ have bridging casts of that kind for now.
18-
if let object = value as? AnyObject {
19-
return __SwiftValue.fetch(nonOptional: object)
20-
} else {
21-
return value
22-
}
16+
let object = value as AnyObject
17+
return __SwiftValue.fetch(nonOptional: object)
2318
}
2419

2520
open class UserDefaults: NSObject {

0 commit comments

Comments
 (0)