-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
[SR-4451] type(of:) behaviour change from Swift 3.0.2 to Swift 3.1. #47028
Comments
Comment by Razvan Popescu (JIRA) Attached playground. |
I suspect it is our boxing behavior that's changed. @jckarter, thoughts? |
If |
Yeah, it seems to me like that warning ought to fire here. |
@swift-ci create |
razvandub (JIRA User), if I understand correctly, the concern is that we do not emit a warning for the function conversion in something like this: struct P {
init(_ fn: (Any?, [String : Any]?) -> Bool) {}
}
let p = P { (a: Any, _) -> Bool in } is that correct? |
Comment by Razvan Popescu (JIRA) @rudkx, the core issue was the change in type(of: oItem) behaviour/output when switching from Swift 3.0.2 to Swift 3.1+. Based on @jckarter's reply above, it looks like it may have been a Swift 3.0.2 bug. If that's the case and the Swift 3.1+ type(of: oItem) behaviour is correct, then yes, I would have expected a warning there. Thanks. |
Attachment: Download
Additional Detail from JIRA
md5: 59a922e46e7486ff5d399c2af0e0d2d8
Issue Description:
It seems that the behaviour of "type(of: )" has changed from Swift 3.0.2 to Swift 3.1 w.r.t. optional Any? closure parameters referenced as Any.
"type(of: oItem) as? T.Type" below returns "__NSCFString.Type" when using Swift 3.0.2 compiler and "nil" when using Swift 3.1 compiler.
The text was updated successfully, but these errors were encountered: