I have a little problem, here is the faulty code:
protocol ConstraintProtocol { }
protocol AssocProtocol {
associatedtype T : ConstraintProtocol
}
protocol MyProtocol : ConstraintProtocol { }
enum ConcreteType: AssocProtocol {
typealias T = MyProtocol
case a
}
The error states the usual type 'ConcreteType' does not conform to protocol 'AssocProtocol'
even giving a hint: possibly intended match 'ConcreteType.T' (aka 'MyProtocol') does not conform to 'ConstraintProtocol'
But... MyProtocol
does conform to ConstraintProtocol
!!!
And indeed, if I remove the constraint from the associatedtype
, it works like a charm.
So, is it just me, or did I miss something?
I'm using Swift 4.1 in Xcode 9.3.1, if it can help.