Unexpected compiler error decomposing array using ternary operator

Originator:morganchen12
Number:rdar://23056128 Date Originated:October 9, 2015
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 7.1 Beta (7B75)
Classification: Reproducible:Always
 
Summary:
Swift playground errors with message "Ambiguous reference to member 'subscript'" when trying to decompose an array into an optional tuple `(Element, [Element])?` in a single line ternary statement.

Steps to Reproduce:
1. Create a blank playground.

2. Paste in the following code.

let array = [1, 2, 3, 4, 5]

let decompose: (Int, [Int])? = (array.count > 0) ? .Some(array[0], Array(array[0..<array.count])) : .None

let ambiguous = (array.count > 0) ? .Some(array[0], Array(array[0..<array.count])) : .None


Expected Results:
The resulting type of the ternary statement is unambiguous, so swift should not error with an ambiguous error message.

Actual Results:
The last line of code produces an error: "Ambiguous reference to member 'subscript'"

Version:
Xcode 7.1 beta (7B75) on OS X 10.11 El Capitan

Notes:
I'll attempt to reproduce this bug on the latest Xcode 7.1 beta and update this ticket if anything changes.

Configuration:
Vanilla Xcode install

Comments

Present in Xcode 7.1 beta 3 (7B85) as well

By morganchen12 at Oct. 9, 2015, 11:04 p.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!