Skip to content

SR-8918: warning: conditional cast from 'Any' to 'AnyObject' always succeeds #2613

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 16, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions Foundation/UserDefaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,8 @@ private var registeredDefaults = [String: Any]()
private var sharedDefaults = UserDefaults()

fileprivate func bridgeFromNSCFTypeIfNeeded(_ value: Any) -> Any {
// 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,
// but is required for non-Darwin to work correctly, since that platform _doesn't_ have bridging casts of that kind for now.
if let object = value as? AnyObject {
return __SwiftValue.fetch(nonOptional: object)
} else {
return value
}
let object = value as AnyObject
return __SwiftValue.fetch(nonOptional: object)
}

open class UserDefaults: NSObject {
Expand Down