Swift - Compile error when constraining associated type -
so don't have write code replicate error - might should using generics in case, feels solution should work. following block of code gives me "type dcserviceclient not conform protocol dmserviceclient":
protocol dmserviceendpoint { } protocol dcserviceendpoint: dmserviceendpoint { } protocol dmserviceclient { typealias endpoint: dmserviceendpoint } class dcserviceclient: dmserviceclient { typealias endpoint = dcserviceendpoint }
however, if remove constraint on associated type (endpoint), compiles without issues. because dcserviceendpoint conforms constraint (dmserviceendpoint) seems should compile. ideas i'm missing here? guys!
protocol dmserviceendpoint { } protocol dcserviceendpoint: dmserviceendpoint { } protocol dmserviceclient { typealias endpoint: dmserviceendpoint } class dcserviceclient: dmserviceclient { typealias endpoint = newclass // implementation class conforms endpoint } // add new class conforms dmserviceendpoint class newclass: dcserviceendpoint {}
Comments
Post a Comment