Swift: chaining does not work in tuples of lvalues

Originator:garth
Number:rdar://18963168 Date Originated:12-Nov-2014 04:16 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 6.1 (6A1052d)
Classification:Other Bug Reproducible:Always
 
Summary:
Variables and explicitly unwrapped optional variables seem to work fine as lvalues in tuples on the lhs of an assignment. But chained expressions (e.g., foo?.x) produce an error.

Steps to Reproduce:
Try this in a playground:

class Test {
    var a: Int = 8
    var b: Int = 9
}

var t: Test     = Test()
var optT: Test? = Test()

(t.a, t.b)         = (2, 3) // Works fine
(optT!.a, optT!.b) = (2, 3) // Works fine

// Err: "Cannot assign to the result of this expression"
(optT?.a, optT?.b) = (2, 3)

Expected Results:
Since the following are valid:

optT?.a = 2
optT?.b = 3

Then this should be valid as well, but is not:

(optT?.a, optT?.b) = (2, 3)

Actual Results:
Rejected by compiler

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!