Missing return type in swift function signature produces misleading error message
| Originator: | vegather | ||
| Number: | rdar://23550578 | Date Originated: | Nov 15th 2015 |
| Status: | Duplicate(23380548) | Resolved: | Closed |
| Product: | Developer Tools | Product Version: | Xcode 7.1.1 (9081) |
| Classification: | Enhancement | Reproducible: | YES |
Summary:
Writing a function in swift that returns the result of a '||' on two Bool variables, but without the ... -> Bool at the end of the signature, produces an unexpected an misleading error message.
Steps to Reproduce:
1. Type the following function into a Swift document in Xcode:
func foo() {
return true || false
}
2. Notice the error message
Expected Results:
Expected the error message: "Unexpected non-void return value in void function", then a quick-fix that adds "-> Bool" to the end of the function signature.
Actual Results:
Got the error message: "Binary operator '||' cannot be applied to two 'Bool' operands", and no quick-fix.
Version:
Xcode 7.1.1 (9081)
Notes:
Configuration:
Attachments:
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!