Compiler error with derived integer types in XCTestEqual
| Originator: | zwaldowski | ||
| Number: | rdar://18495219 | Date Originated: | 29-Sep-2014 |
| Status: | Closed | Resolved: | true |
| Product: | Developer Tools | Product Version: | Xcode 6.1 Beta 3 (6A1042b) |
| Classification: | Serious Bug | Reproducible: | Sometimes |
Summary:
In Xcode 6.1 Beta 3,
Steps to Reproduce:
1. Create a new project with a unit test target.
2. Define a class with a property that returns a `UInt64`.
3. In a test method, instantiate the class.
4. Use `XCTestEqual` with a literal on one side ("6") and the property on the other ("obj.anInt64")
5. Build.
6. Observe compilation error.
Expected Results:
The project compiles and the tests execute successfully.
Actual Results:
Compliation error: "Type 'autoclosure () -> UInt64' does not conform to protocol 'IntegerLiteralConvertible'"
Version:
Xcode Version 6.1 (Beta 3 - 6A1042b), OS X Version 10.10 (Beta 3 - 14A361p)
Notes:
Workaround: specify the literal as "UInt64(8)".
Despite the existence of a workaround, this is a total regression. For a generic method, the Swift compiler should be able to speculatively determine that `UInt64` is compatible with `IntegerLiteralConvertible` as it always have. Though Swift recommends using Int at all costs, sometimes that is out of our hands (frameworks, etc.).
Configuration:
Occurs with specific derivatives of numeric types, but not the base numeric types. i.e., it happens with CGFloat/FloatLiteralConvertible, Float/FloatLiteralConvertible (64), Double/FloatLiteralConvertible (32), and with all the specific-type Int and IntegerLiteralConvertible.
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!
This issue has been verified as resolved and can be closed. Resolved in GM 2 or so, definitely resolved by 6.1 6A1052d.