Skip to content

Instantly share code, notes, and snippets.

@cassdeckard
Last active February 20, 2017 19:10
Show Gist options
  • Select an option

  • Save cassdeckard/3963022c80b83b6357b312a56e0b356b to your computer and use it in GitHub Desktop.

Select an option

Save cassdeckard/3963022c80b83b6357b312a56e0b356b to your computer and use it in GitHub Desktop.
Potential bug in Swift compiler?
import Foundation
public class BaseClass<H> {
public init?() {
}
}
import Foundation
public class ClassA: BaseClass<Int> {
// NOTE: Uncommenting this makes the error go away. Why???
//public convenience init?(_ whatever: Int) { fatalError() }
}
import Foundation
public class ClassB: BaseClass<Bool> {
public func makeA() -> ClassA? {
return ClassA() // error: '() -> ClassA' is not convertible to '() -> ClassA?'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment