<div dir="ltr">Very interesting. Is this likely to be changed in the future (either existentials conforming to their protocols, or `S: Protocol` specifically allowing for existentials)?<div><br></div><div>Also, is this at all related? Another instance of at naive/face value something seeming like it should conform, but not.. </div><div><br></div><div>protocol Special {}</div><div>protocol SubSpecial: Special {}</div><div><br></div><div>let spec: Special.Protocol = Special.self // works</div><div>let subspec: Special.Protocol = SubSpecial.self // doesnt work<br><div><br></div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 9, 2017 at 7:17 PM, Austin Zheng <span dir="ltr"><<a href="mailto:austinzheng@gmail.com" target="_blank">austinzheng@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">A existential type of some protocol `P`, counterintuitively, doesn't conform to itself, unless it's an Objective-C protocol.<br>
<br>
Because `S : Special` means S has to be a type that conforms to the protocol `Special`, and `special` is of the existential type `Special`, the existential type `Special` doesn't conform to the protocol `Special`, so it can't be used for `S`.<br>
<br>
Best,<br>
Austin<br>
<div><div class="h5"><br>
> On Aug 9, 2017, at 7:19 AM, Mathew Huusko V via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br>
><br>
><br>
> Curious what part of generics the below would fall under? This hit me by surprise/makes even non-generic/Self-depending protocols un-interchangeable with classes..<br>
><br>
> ```<br>
> protocol Special {}<br>
><br>
> func doWithAndReturn<S: Special>(_ special: S) -> S { ... }<br>
><br>
> let special: Special = ...<br>
><br>
> // "error: Generics parameter 'S' could not be inferred"<br>
> // works fine when 'Special' is a class<br>
> let newSpecial: Special = doWithAndReturn(special)<br>
> ```<br>
</div></div>> ______________________________<wbr>_________________<br>
> swift-evolution mailing list<br>
> <a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
> <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br>
<br>
</blockquote></div><br></div>