Strange compiler errors when doing slightly advanced things with generics
| Originator: | histumness | ||
| Number: | rdar://20989596 | Date Originated: | 5/16/2015 |
| Status: | Open | Resolved: | |
| Product: | Developer tools | Product Version: | |
| Classification: | Reproducible: | Yes |
Summary: Sorry for the vague title, I don't have the vocabulary to succinctly describe what is going on. If you compile the attached Swift file as an XCTest you should see the strange compiler errors, including the error "BugInSwiftGenerics.swift:39:16: Cannot convert return expression of type '() -> ()' to expected return type '() -> ()'" which is what really makes me think this is a compiler bug. Basically the strangeness seems to occur if you try to define a generic class like so: class SomeClass<T, U: SomeOtherClass<T>> The compiler seems to generally choke on anything you try to do with the U type, i.e init, call functions on it, etc. Steps to Reproduce: 1. Put the attached swift test file in a project as an XCTest 2. Attempt to build the project Expected Results: The test file compiles Actual Results: Unexpected errors like "BugInSwiftGenerics.swift:39:16: Cannot convert return expression of type '() -> ()' to expected return type '() -> ()'" If I remove the "Equatable" requirements from all of my types and recompile, the compiler consistently crashes with the attached stack trace Version: Xcode 6.3.1 Build version 6D1002 OS X 10.10.3 (14D136)
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!