Below is a SSCCE of a Swift 4 framework I'm working on in Xcode 9 Beta 5:
// MARK: - Protocols
public protocol BaseFoo {
associatedtype FooBar: Bar
}
public protocol Bar {
associatedtype BarData: DataHolder
}
public extension Bar {
public typealias Callback = BarCallback<BarData>
}
public typealias BarCallback<Result: DataHolder> = (Result?, Error?) -> Void
public protocol DataHolder {
}
// MARK: - Implementations
public class MyFoo: BaseFoo { // Does not compile
public typealias FooBar = MyBar
}
public protocol MyBar: Bar where BarData: MyDataHolder {
}
public protocol MyDataHolder: DataHolder {
}
But the compiler complains that "Type 'MyFoo' does not conform to protocol 'BaseFoo'
". Xcode asks "Do you want to add protocol stubs?" and when I click "Fix", it does this:
public class MyFoo: BaseFoo {
public typealias FooBar = <#type#>
public typealias FooBar = MyBar
}
That seems to indicate that MyBar
is not the proper type to satisfy FooBar
, but it's clearly a DataHolder
, just as required. What's going on here, and how do I fix it?