Conditional cast from 'any Error' to 'any Equatable' always succeeds... but doesn't
Description
The compiler tells me that the cast from 'any Error' to 'any Equatable' always succeeds, but then tells me that it doesn't.
Reproduction
enum SomeError: Error {
case error
}
let t: any Error = SomeError.error
func needsEquatable<E: Equatable>(e: E) {
}
if let t = t as? (any Equatable) { // Warning: Conditional cast from 'any Error' to 'any Equatable' always succeeds
needsEquatable(e: t)
}
needsEquatable(e: t) // Error: Global function 'needsEquatable(e:)' requires that 'E' conform to 'Equatable'
Expected behavior
I don't think that Error is Equatable, so the warning is probably wrong.
Environment
swift-driver version: 1.87.1 Apple Swift version 5.9 (swiftlang-5.9.0.128.108 clang-1500.0.40.1) Target: arm64-apple-macosx14.0
Additional information
No response
@AnthonyLatsis this one seems to have been overlooked. This is still an issue in Xcode Version 16.0 beta 4 (16A5211f).
+1
seeing similar issue here but when trying to cast any Error to CustomDebugStringConvertible
CC: @xedin
This is still an issue as of Xcode Version 26.0.1 (17A400)