Currently the behaviors are inconsistent. Run the following code to see.
let a: String? = "hello"
let b: NSString? = "hello"
let c: CFString? = "hello"
a as? NSString
//a as? CFString
a as? NSString?
a as? CFString?
b as? String
//b as? CFString
b as? String?
b as? CFString?
c as? String
c as? NSString
c as? String?
c as? NSString?
How I found the bug:
One line of my real code casting CFData? to NSData unexpectedly returns nil.
Environment
Swift 3 in Xcode 8.0 beta 6Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 1 | |Component/s | | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: 2b64786b151ae4485b41c34c064a5cbbIssue Description:
Source: https://twitter.com/an0/status/709783896263536640
Currently the behaviors are inconsistent. Run the following code to see.
How I found the bug:
One line of my real code casting CFData? to NSData unexpectedly returns nil.