Appending a tuple to an array fails with an error
| Originator: | fluidsonic | ||
| Number: | rdar://21669419 | Date Originated: | 2015-07-03 |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode 7 Beta 2 |
| Classification: | Other Bug | Reproducible: | Always |
Summary: The following code was valid in Swift 1: var array = [(Int,Int)]() array.append((1, 2)) // "error: missing argument for parameter #2 in call" in Swift 2 In Swift 2 Array.append now expects both tuple elements as separate parameters instead of a single tuple parameter: var array = [(Int,Int)]() array.append(1, 2) This looks like a bug. Steps to Reproduce: 1. Paste the first code example from the description into a Playground. 2. Check the resulting compile error. Expected Results: Array.append should require tuple syntax like everywhere else in Swift: array.append((1, 2)) instead of array.append(1, 2) Actual Results: Array.append expects tuple elements to be passed as separate parameters.
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!