Swift: Dictionaries with nested Dictionaries / Arrays should be equatable
| Originator: | raise.rescue | ||
| Number: | rdar://18707590 | Date Originated: | 20-Oct-2014 04:18 PM |
| Status: | Duplicate of 17144340 | Resolved: | |
| Product: | Product Version: | ||
| Classification: | Reproducible: |
Summary: Simple dictionaries can be compared without writing boilerplate-code, which is nice. But as soon as dictionaries have dictionaries / arrays as values, they are no longer comparable, which is bad. Steps to Reproduce: This code-snippet outlines the problem: var r: Bool var dict = [1 : 2] // this works, as expected r = dict == dict var dictionaryInDictionary = [1 : [2 : 3]] // this should work, but the compiler says error: '[Int : Dictionary<Int, Int>]' is not convertible to 'MirrorDisposition' r = dictionaryInDictionary == dictionaryInDictionary var arrayInDictionary = [1: [2]] // this should work, but the compiler says error: '[Int : Array<Int>]' is not convertible to 'MirrorDisposition' r = arrayInDictionary == arrayInDictionary
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!