Compiler fails to disambiguate .map(Data.init) in Xcode 10 Beta 4
Originator: | claytonrellis | ||
Number: | rdar://42440274 | Date Originated: | 2018-7-20 |
Status: | Open | Resolved: | |
Product: | Xcode | Product Version: | Xcode 10 Beta 4 |
Classification: | Crash/Hang | Reproducible: | Always |
Summary: Given the following code: ``` import Foundation let data = "hello, world".data(using: .utf8)! let slices = data.split(separator: 0x2C) let a = slices.map(Data.init) let b = slices.map { Data($0) } ``` The compiler will fail on line 6 `.map(Data.init)` with the error `Ambiguous use of 'init'`. However, it succeeds on line 7 which is using the same initializer: `public init<S>(_ elements: S) where S : Sequence, S.Element == UInt8`. Steps to Reproduce: 1. Open the attached Playground 2. Observe that it fails to build with an error on line 6 `Ambiguous use of 'init'` 3. Comment out line 6 4. Observe that the Playground build succeeds Expected Results: That the compiler can disambiguate `.map(Data.init)` which is: `public init<S>(_ elements: S) where S : Sequence, S.Element == UInt8` Actual Results: The compiler fails to disambiguate `.map(Data.init)`. Version/Build: Xcode 10 Beta 4 (10L213o)
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!