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

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -