Misleading Swift compiler error in functions that shouldn't return a value
| Originator: | keithbsmiley | ||
| Number: | rdar://23239024 | Date Originated: | 23-Oct-2015 12:04 PM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Swift 2.1 |
| Classification: | Other Bug | Reproducible: | Always |
Summary: When returning an expression using bools and a condition from a Swift function that doesn't expect a return value, the compile error is misleading. Steps to reproduce: 1. Create a Swift function returns nothing 2. Return `true && true` OR: 1. Run `swiftc BoolWarning.swift` Expected results: The compile should produce an error message similar to that if you return a single value from a function that doesn't return anything. Actual results: The compiling produces a misleading error message saying a binary operator cannot be applied to 2 bools. Notes: - See expected.log and actual.log for examples
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!
https://github.com/keith/radars/tree/master/BoolVoidReturnWarning