<div dir="ltr">Does anyone have an idea when this is going to be fixed? Or when support will be implemented?<div>My app heavily uses collections of heterogenous plug-ins, so it's a real pain in the neck to work around.<div><div><div><div><br></div></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 2, 2017 at 2:08 AM, Satoshi Nakagawa via swift-users <span dir="ltr"><<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Slava,<div><br></div><div>Thanks for your quick response!</div><div><br></div><div>I see. That's in line with what I can read from the Type Constraint Syntax section in the official Swift book.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div><div>Satoshi</div><div><br></div></div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 2, 2017 at 1:59 AM, Slava Pestov <span dir="ltr"><<a href="mailto:spestov@apple.com" target="_blank">spestov@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Satoshi,<br>
<br>
Protocols do not conform to themselves. Only concrete types can conform to protocols in the current implementation of Swift.<br>
<br>
Slava<br>
<div><div class="m_4819400204996968401h5"><br>
> On May 2, 2017, at 1:57 AM, Satoshi Nakagawa via swift-users <<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a>> wrote:<br>
><br>
> Hi,<br>
><br>
> I got a build error "Generic parameter 'T' could not be inferred" for the following code.<br>
><br>
> Can anyone explain why we can't use a protocol to infer the generic type T?<br>
><br>
> class Emitter {<br>
> func emit<T: Emittable>() -> T {<br>
> ...<br>
> }<br>
> }<br>
><br>
> protocol Emittable {}<br>
> protocol Subemittable: Emitable {}<br>
><br>
> class ConcreteEmittable: Subemittable {}<br>
><br>
> func testCode() {<br>
> let emitter = Emitter()<br>
><br>
> // Error: Generic parameter 'T' could not be inferred<br>
> let _: Emittable = emitter.emit()<br>
><br>
> // Error: Generic parameter 'T' could not be inferred<br>
> let _: Subemittable = emitter.emit()<br>
><br>
> // This works<br>
> let _: ConcreteEmittable = emitter.emit()<br>
> }<br>
><br>
> Thanks,<br>
> Satoshi<br>
><br>
</div></div>> ______________________________<wbr>_________________<br>
> swift-users mailing list<br>
> <a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a><br>
> <a href="https://lists.swift.org/mailman/listinfo/swift-users" rel="noreferrer" target="_blank">https://lists.swift.org/mailma<wbr>n/listinfo/swift-users</a><br>
<br>
</blockquote></div><br></div>
</div></div><br>______________________________<wbr>_________________<br>
swift-users mailing list<br>
<a href="mailto:swift-users@swift.org">swift-users@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-users" rel="noreferrer" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-users</a><br>
<br></blockquote></div><br></div>