The following initializer fails its precondition under Swift 6.4 when T is an array:
public init<T>(_ objCPromise: ObjCPromise<T>) {
guard let objCPromise = objCPromise as? ObjCPromise<AnyObject> else {
preconditionFailure("Cannot cast \(T.self) to \(AnyObject.self)")
}
self.objCPromise = objCPromise
}
The function to get an ObjCPromise from a Promise (relying on the same Array → AnyObject cast) does too.
Replacing the current cast with an unsafeBitCast seems to fix the issue in both cases, but I haven't yet tested it thoroughly enough to be certain.
The following initializer fails its precondition under Swift 6.4 when
Tis an array:The function to get an
ObjCPromisefrom aPromise(relying on the sameArray→AnyObjectcast) does too.Replacing the current cast with an
unsafeBitCastseems to fix the issue in both cases, but I haven't yet tested it thoroughly enough to be certain.