[SR-1581] Can not use protocol to fulfill associatedtype requirement where associatedType has protocol constraint Created: 21 May 2016 Updated: 23 Apr 2017 Resolved: 23 Apr 2017
The following code sample does not compile.
It throws error:
I am not sure if we are only allowed to use a concrete type for associatedtype with protocol constraint. I don't see any reason for this restriction. If we remove the protocol constraint from associatedtype, then it compiles with no error.
Update 2016/12/12: I am using below workaround to tackle above bug. This seems more logical and makes me feel like its not a bug.
The reason this makes more sense to me is that the compiler now has more context on the actual type.
|Comment by Jordan Rose [ 23 May 2016 ]|
Protocols don't always "conform to themselves", but this configuration seems safe. Joe Groff?
|Comment by Karl [ 27 Jun 2016 ]|
+1 for this. The thing that we want to express is safe; if there are nuances with the current syntax we should devise a way to make it possible.