Hello everyone,
I have a project in which I created several protocols that have an associatedType, implemented by some generic classes. In particular, there is a protocol with a method requirement and an associatedType, and this type conforms to another protocol that has another associatedType. When I try to build the project, the compiler crashes, giving a Segmentation fault error when trying to build the method I mentioned before but without explaining the reason.
Of course the code is much more complex than this, but I managed to reproduce the issue in a short playground:
protocol C {
associatedtype Type1
}
protocol B {
associatedtype Type2: C
func register()
}
extension B {
func register() {
print("Hello")
}
}
class MyClass: C {
typealias Type1 = Int
}
class MyGeneric<T>: B where T: C {
typealias Type2 = T
}
let c = MyGeneric<MyClass>()
c.register()
I don't know what should be the issue in this code, but at least I think the compiler should report it.