<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Looking into this a bit further, I see that this use case is specifically mentioned in the generics manifesto under the ‘unlikely' section.<div class=""><br class=""></div><div class=""><a href="https://github.com/apple/swift/blob/master/docs/GenericsManifesto.md#conditional-conformances-via-protocol-extensions" class=""></a><a href="https://github.com/apple/swift/blob/master/docs/GenericsManifesto.md#conditional-conformances-via-protocol-extensions" class=""></a><a href="https://github.com/apple/swift/blob/master/docs/GenericsManifesto.md#conditional-conformances-via-protocol-extensions" class="">https://github.com/apple/swift/blob/master/docs/GenericsManifesto.md#conditional-conformances-via-protocol-extensions</a><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Dec 6, 2017, at 07:35, Matt Whiteside <mwhiteside.dev@gmail.com> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Thanks Jens. Your example does work for me. The use case I have been trying to accomplish is conditional conformance of a protocol, not a struct. After re-reading, it looks like this is not covered by SE-0143.<div class=""><br class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><div style="font-family: Menlo; font-size: 13px; margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="color: #ba2da2" class="">import</span> CoreGraphics</div><div style="font-family: Helvetica; font-size: 12px; margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class=""><br class=""></div><div style="font-family: Menlo; font-size: 13px; margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="color: #ba2da2" class="">protocol</span> Drawable {</div><div style="font-family: Menlo; font-size: 13px; margin: 0px; font-stretch: normal; line-height: normal;" class=""> <span style="color: #ba2da2" class="">func</span> draw()</div><div style="font-family: Menlo; font-size: 13px; margin: 0px; font-stretch: normal; line-height: normal;" class="">}</div><div style="font-family: Helvetica; font-size: 12px; margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class=""><br class=""></div><div style="font-family: Menlo; font-size: 13px; margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="color: #ba2da2" class="">protocol</span> Point2D{</div><div style="font-family: Menlo; font-size: 13px; margin: 0px; font-stretch: normal; line-height: normal; color: rgb(112, 61, 170);" class=""><span style="" class=""> </span><span style="color: #ba2da2" class="">associatedtype</span><span style="" class=""> T:</span>FloatingPoint<span style="" class=""> & </span>ExpressibleByFloatLiteral</div><div style="font-family: Menlo; font-size: 13px; margin: 0px; font-stretch: normal; line-height: normal;" class=""> <span style="color: #ba2da2" class="">var</span> x:<span style="color: #703daa" class="">T</span>{</div><div style="font-family: Menlo; font-size: 13px; margin: 0px; font-stretch: normal; line-height: normal;" class=""> <span style="color: #ba2da2" class="">get</span></div><div style="font-family: Menlo; font-size: 13px; margin: 0px; font-stretch: normal; line-height: normal;" class=""> }</div><div style="font-family: Menlo; font-size: 13px; margin: 0px; font-stretch: normal; line-height: normal;" class=""> <span style="color: #ba2da2" class="">var</span> y:<span style="color: #703daa" class="">T</span>{</div><div style="font-family: Menlo; font-size: 13px; margin: 0px; font-stretch: normal; line-height: normal;" class=""> <span style="color: #ba2da2" class="">get</span></div><div style="font-family: Menlo; font-size: 13px; margin: 0px; font-stretch: normal; line-height: normal;" class=""> }</div><div style="font-family: Menlo; font-size: 13px; margin: 0px; font-stretch: normal; line-height: normal;" class="">}</div><div style="font-family: Helvetica; font-size: 12px; margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="color: rgb(186, 45, 162); font-family: Menlo; font-size: 13px; text-decoration: underline;" class="">e</span><span style="color: rgb(186, 45, 162); font-family: Menlo; font-size: 13px;" class="">xtension</span><span style="font-family: Menlo; font-size: 13px;" class=""> </span><font color="#703daa" face="Menlo" size="2" class="">Collection</font><span style="font-family: Menlo; font-size: 13px;" class="">: </span><span style="color: rgb(112, 61, 170); font-family: Menlo; font-size: 13px; text-decoration: underline;" class="">Drawable</span><span style="font-family: Menlo; font-size: 13px;" class=""> </span><span style="color: rgb(186, 45, 162); font-family: Menlo; font-size: 13px;" class="">where</span><span style="font-family: Menlo; font-size: 13px;" class=""> </span><font color="#703daa" face="Menlo" size="2" class="">Element</font><span style="font-family: Menlo; font-size: 13px;" class="">:</span><span style="color: rgb(79, 129, 135); font-family: Menlo; font-size: 13px;" class="">Point2D</span><font face="Menlo" size="2" class=""> {//error: Extension of protocol ‘Collection’ cannot have an inheritance clause</font></div><div style="font-family: Menlo; font-size: 13px; margin: 0px; font-stretch: normal; line-height: normal;" class=""> <span style="color: #ba2da2" class="">func</span> draw(){</div><div style="font-family: Menlo; font-size: 13px; margin: 0px; font-stretch: normal; line-height: normal; color: rgb(209, 47, 27);" class=""><span style="" class=""> </span><span style="color: #3e1e81" class="">print</span><span style="" class="">(</span>"drawing something here"<span style="" class="">)</span></div><div style="font-family: Menlo; font-size: 13px; margin: 0px; font-stretch: normal; line-height: normal;" class=""> }</div><div style="font-family: Menlo; font-size: 13px; margin: 0px; font-stretch: normal; line-height: normal;" class="">}</div><div style="font-family: Menlo; font-size: 13px;" class=""><br class=""></div></div></div><div class=""><div class="">Matt</div><div class=""><br class=""></div><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Dec 6, 2017, at 00:25, Jens Persson <<a href="mailto:jens@bitcycle.com" class="">jens@bitcycle.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Oh I forgot to include the step where I select the newly installed toolchain ...</div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Wed, Dec 6, 2017 at 9:24 AM, Jens Persson via swift-users <span dir="ltr" class=""><<a href="mailto:swift-users@swift.org" target="_blank" class="">swift-users@swift.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class=""><span class=""><div class="">I've now installed 2017-12-05 snapshot and can confirm that it too works for me.</div><div class="">In more detail:</div><div class=""><br class=""></div><div class="">1. Install swift-DEVELOPMENT-<wbr class="">SNAPSHOT-2017-12-05-a-osx.pkg</div><div class=""><br class=""></div><div class="">2. Restart Xcode (I'm using Xcode 9.2 (9C40b))</div><div class=""> (I guess it shouldn't be necessary to restart, but I think it might be ...)<br class=""></div><div class=""><br class=""></div><div class="">3. Create a new command line project.</div><div class=""><br class=""></div><div class="">4. Put <span style="color:rgb(80,0,80);font-size:12.800000190734863px" class="">-enable-experimental-</span><span style="color:rgb(80,0,80);font-size:12.800000190734863px" class="">condi<wbr class="">tional-conformances in Other Swift Flags in the project's Build Settings.</span></div><div class=""><br class=""></div><div class="">5. Enter the following code in main.swift and Build (which works without errors):</div><div class=""><br class=""></div><div class=""><div class="">protocol P {}</div><div class="">struct S<T> {}</div><div class="">extension S: P where T: P {}</div></div><div class=""><br class=""></div><div class=""><br class=""></div>Regarding step 2. I'm not 100% sure, but I think that it might be necessary to restart Xcode after installing a new snapshot, because even if the new snapshot can be selected from the toolchains menu, it doesn't take affect until after restarting Xcode. I'm always restarting Xcode after installing and selecting a new toolchain. Someone please correct me if you can prove that this isn't necessary.<div class=""><br class=""></div></span><div class="">/Jens</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote"><span class="">On Wed, Dec 6, 2017 at 7:48 AM, Jens Persson via swift-users <span dir="ltr" class=""><<a href="mailto:swift-users@swift.org" target="_blank" class="">swift-users@swift.org</a>></span> wrote:<br class=""></span><div class=""><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><div dir="ltr" class="">It works for me with Xcode 9.1 and 9.2 using latest dev snapshot (from 2017-11-28 and 2017-12-03), I added -enable-experimental-con<wbr class="">ditional-conformances in Other Swift Flags as you show in the screenshot.<div class="">/Jens</div></div></span><div class="gmail_extra"><br class=""><div class="gmail_quote"><span class="">On Wed, Dec 6, 2017 at 4:32 AM, Matt Whiteside via swift-users <span dir="ltr" class=""><<a href="mailto:swift-users@swift.org" target="_blank" class="">swift-users@swift.org</a>></span> wrote:<br class=""></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class=""><div class="m_-8817220900050462956h5"><div style="word-wrap:break-word" class="">Hello Swift Users,<div class=""><br class=""></div><div class="">[This is a resend with smaller attachment] Has anyone had luck passing the new '-enable-experimental-conditio<wbr class="">nal-conformances' flag to Xcode? It works when I run swift from the command line, with the Dec. 5th snapshot toolchain, but not Xcode. I have tried whats in the screenshot below as well as adding -Xfrontend, but I’m still getting the usual ‘extension of protocol cannot have an inheritance clause’ error:</div><div class=""><br class=""></div><div class="">Thanks for any suggestions on this,</div><div class=""><br class=""></div><div class="">Matt</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><span id="cid:557DE12E-FFE6-489B-B789-AFCF8A44EB91" class=""><Screen Shot 2017-12-05 at 19.19.06.png></span></div><div class=""><br class=""></div><div class=""><br class=""></div></div><br class=""></div></div><span class="">______________________________<wbr class="">_________________<br class="">
swift-users mailing list<br class="">
<a href="mailto:swift-users@swift.org" target="_blank" class="">swift-users@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-users" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailma<wbr class="">n/listinfo/swift-users</a><br class="">
<br class=""></span></blockquote></div><br class=""></div>
<br class="">______________________________<wbr class="">_________________<br class="">
swift-users mailing list<br class="">
<a href="mailto:swift-users@swift.org" target="_blank" class="">swift-users@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-users" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailma<wbr class="">n/listinfo/swift-users</a><br class="">
<br class=""></blockquote></div></div></div><br class=""></div>
<br class="">______________________________<wbr class="">_________________<br class="">
swift-users mailing list<br class="">
<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-users" rel="noreferrer" target="_blank" class="">https://lists.swift.org/<wbr class="">mailman/listinfo/swift-users</a><br class="">
<br class=""></blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></div></div></div></div></blockquote></div><br class=""></div></body></html>