We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Swift version 4.2-dev (LLVM d9cd6a5c49, Clang ed8876508e, Swift c363dad) Target: x86_64-apple-darwin17.5.0
md5: 241ea289c2d537b07e80e0f58cf55573
is duplicated by:
Issue Description:
This cast succeeds:
func foo(_ t: Int??) -> Int? { return t as? Int } let x = foo(Int??(3)) print(x as Any) // Optional(3)
but it fails when we use a generic placeholder satisfied by Int rather than Int directly. This cast fails:
Int
func bar<U>(_ t: Int??, _: U.Type) -> U? { return t as? U } let y = bar(Int??(3), Int.self) print(y as Any) // nil
The text was updated successfully, but these errors were encountered:
@rudkx, you were looking at some of this, right?
Sorry, something went wrong.
@swift-ci create
I was looking at something a little different than this that did not involve generics.
This seems like it must be an issue with the conditional casting support in the runtime.
Fixed in this PR: #16772
No branches or pull requests
Environment
Swift version 4.2-dev (LLVM d9cd6a5c49, Clang ed8876508e, Swift c363dad)
Target: x86_64-apple-darwin17.5.0
Additional Detail from JIRA
md5: 241ea289c2d537b07e80e0f58cf55573
is duplicated by:
Issue Description:
This cast succeeds:
but it fails when we use a generic placeholder satisfied by
Int
rather thanInt
directly. This cast fails:The text was updated successfully, but these errors were encountered: