Now we have AnyHashable, NSUniqueObject in the archiver can go. I’ll file a PR.

— Luke

> On 11 Aug 2016, at 4:29 AM, Tony Parker via swift-dev <swift-dev@swift.org> 
> wrote:
> 
> We have fixes ready to go for this keyed archiver issue but the inability to 
> get past CI has slowed us down on putting it in.
> 
> - Tony
> 
>> On Aug 9, 2016, at 12:02 PM, Joe Groff via swift-dev <swift-dev@swift.org 
>> <mailto:swift-dev@swift.org>> wrote:
>> 
>>> 
>>> On Aug 4, 2016, at 1:21 PM, Philippe Hausler via swift-dev 
>>> <swift-dev@swift.org <mailto:swift-dev@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?
>> 
>> This is the same problem you raised recently on 
>> https://bugs.swift.org/browse/SR-2287 
>> <https://bugs.swift.org/browse/SR-2287>. Coercing something to AnyObject on 
>> Darwin will bridge it, by boxing if there is no corresponding bridged type. 
>> Since you're coercing an Optional, and Optional doesn't bridge, you end up 
>> with a boxed Optional. To work around this, you could do 'dict["$class"].map 
>> { $0 as AnyObject }'.
>> 
>> -Joe
>> 
>>> 
>>> 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@swift.org <mailto:swift-dev@swift.org>
>>> https://lists.swift.org/mailman/listinfo/swift-dev 
>>> <https://lists.swift.org/mailman/listinfo/swift-dev>
>> 
>> _______________________________________________
>> swift-dev mailing list
>> swift-dev@swift.org <mailto:swift-dev@swift.org>
>> https://lists.swift.org/mailman/listinfo/swift-dev 
>> <https://lists.swift.org/mailman/listinfo/swift-dev>
> _______________________________________________
> swift-dev mailing list
> swift-dev@swift.org
> https://lists.swift.org/mailman/listinfo/swift-dev

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

_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev

Reply via email to