wrong compiler error when swift ternary operator branches don't match

Originator:brandon2k3
Number:rdar://18800223 Date Originated:10/28/14
Status:Open Resolved:
Product:Xcode Product Version:6.1 (6A1052d)
Classification: Reproducible:Always?
 
Summary:
wrong compiler error when swift ternary operator branches don't match

https://gist.github.com/NorrinRadd/56d212e4996561df060f

let p =  UILabel()
var prompt: NSString?
p.text = (prompt != nil) ? prompt! : "This is a prompt question"
        
let enter = UIButton.buttonWithType(UIButtonType.System) as UIButton
let bt = (buttonText != nil) ? buttonText : "Enter"
enter.setTitle(bt, forState: UIControlState.Normal)
 
var buttonTextColor: UIColor?
(buttonTextColor != nil) ? enter.setTitleColor(buttonTextColor, forState: UIControlState.Normal) : {};
 
AGViewControllerSwift.swift:10:26: Could not find an overload for '!=' that accepts the supplied arguments
 
/* an error is expected, i supposed
 * but the error given is wrong.  
 * the error should indicate the two branches of the ternary operator don't match in type
 */

Steps to Reproduce:
1. compile the code in the gist
2. see the crazy error message
3. change the {} in the operator to ()
4. no more crazy error message
5. the fix to the problem was not related to the crazy error message

Expected Results:
in step 2, a better error message, that tells what the real problem is.

Actual Results:
an error message that makes no sense

Version:
Xcode 6.1 (6A1052d)
OS X 10.10.0 Release version

Notes:


Configuration:
happens on the most up to date versions of Xcode , OS X Yosemite, and iOS sdks as of Oct 28th, 2014.  My OS X is 10.10

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!