[Swift] Can only use constant values to append to array of tuples

Originator:janoschhildebrand
Number:rdar://17434832 Date Originated:24-Jun-2014 04
Status:Duplicate of 17548368 (Closed) Resolved:
Product:Developer Tools Product Version:Xcode 6 - Beta 2 (6A216f)
Classification:Other Bug Reproducible:Always
 
Summary:
The attached playground shows the problem I am experiencing.

It defines an array of tuples as follows:
var array: (Int, Int)[] = []

Then it tries various ways of appending values to the array. Appending works fine as long as I only use constant ('let' or literal) values. When trying to append values that are declared as variables ('var') the compiler complains about type mismatches.


Perhaps I am missing something here but it seems to be a bug and should be possible.

(Btw, its very nice though that one can append using both a tuple or using the tuple elements - makes sense as Swift seems to treat function arguments as tuples but still - keep up the great work :-))

Steps to Reproduce:


Expected Results:
Using variable values to append to an array of tuples should be possible.

Actual Results:
Using variable values to append to an array of tuples results in compiler errors.

Version:
Xcode 6 - Beta 2 (6A216f)
Swift version 1.0 (swift-600.0.34.4.8)
OS X 10.10 (14A261i)

Comments

Playground

https://www.dropbox.com/s/vmimfqkcfbdunyu/17434832.zip?dl=0

By janoschhildebrand at March 23, 2015, 11:43 a.m. (reply...)

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!