[swift-dev] swift-corelibs-foundation failing in object conversion when building on Darwin host

Luke Howard lukeh at padl.com
Tue Aug 9 00:42:26 CDT 2016


Would it be possible to separate the change to NSKeyedUnarchiver in 1d1ddba9 into a separate commit?

> On 5 Aug 2016, at 6:21 AM, Philippe Hausler via swift-dev <swift-dev at swift.org> wrote:
> 
> With a freshly built toolchain from ToT swift, building ToT swift-corelibs-foundation I am getting some very strange failures in the unit tests:
> 
> Test Suite 'TestNSKeyedArchiver' started at 13:15:01.843
> Test Case 'TestNSKeyedArchiver.test_archive_array' started at 13:15:01.843
> assertion failed: file /Volumes/Users/phausler/Documents/Public/swift/swift-corelibs-foundation/Foundation/NSKeyedArchiver.swift, line 23
> 2016-08-04 13:15:07.650689 TestFoundation[47395:4939580] assertion failed: file /Volumes/Users/phausler/Documents/Public/swift/swift-corelibs-foundation/Foundation/NSKeyedArchiver.swift, line 23
> Current stack trace:
> 
> this is being caused by the line:
> 
> let classReference = innerDecodingContext.dict["$class"] as? CFKeyedArchiverUID
> 
> CFKeyedArchiverUID being AnyObject
> 
> and 
> 
> class DecodingContext {
>        fileprivate var dict : Dictionary<String, Any>
>> }
> 
> It claims a conditional cast from Any? to AnyObject always succeeds but it is giving me an unexpected type later on
> 
> Changing to:
> 
> let classReference = innerDecodingContext.dict["$class"] as CFKeyedArchiverUID?
> 
> Then makes the process no longer crash, however it then fails in an even more strange way:
> 
> 
> guard let root = try unarchiver.decodeTopLevelObjectOfClasses(classes,
>                        forKey: NSKeyedArchiveRootObjectKey) as? NSObject else {
> 
> by expanding that out the decoded object is a NSArray (expected), but that cannot be represented as an NSObject?! This isn’t Swift, this is madness!
> 
> Perhaps there is some other failure that I am not seeing underpinning this?
> _______________________________________________
> swift-dev mailing list
> swift-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-dev

--
www.lukehoward.com
soundcloud.com/lukehoward



More information about the swift-dev mailing list