You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That last example is definitely a bit surprising, but I think it's the same problem that you've noticed in the main issue. The == operator is effectively behaving as an as cast for x and for a: it takes two arguments of the same type and so it needs to make sure both sides match (for the first one, both sides have type Int??, and for the second, both sides have type [Int??]).
Here's a different version of the same problem:
func sameType<T>(_ x: T, _ y: T) {
print(x, y, T.self)
}
let x = Int?.none
let y = Int??.none
sameType(x, y)
let a: [Int?] = [x]
let b: [Int??] = [y]
sameType(a, b)
#33561 should fix this for the non-optimized case (where the cast is being handled by the runtime). There may still be issues with optimized casts, though.
Environment
Xcode Version 9.0 (9A235)
Apple Swift version 4.0 (swiftlang-900.0.65 clang-900.0.37)
Target: x86_64-apple-macosx10.9
Additional Detail from JIRA
md5: d7cc88bec6113716050efba120064739
duplicates:
Issue Description:
I can check unexpected casting behavior combine Array and Optional.
The text was updated successfully, but these errors were encountered: