<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jul 18, 2017, at 18:17, Zhao Xin via swift-users &lt;<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_default" style="font-family:georgia,serif">I encounter this error today. "<span style="color:rgb(0,132,0);font-family:Menlo;font-size:11px" class="">matching a protocol value in multiple patterns is not yet supported; use separate cases instead"</span></div><div class="gmail_default" style="font-family:georgia,serif"><span style="color:rgb(0,132,0);font-family:Menlo;font-size:11px" class=""><br class=""></span></div><div class="gmail_default"><font face="georgia, serif" class="">Sample code:</font></div><div class="gmail_default" style="font-family:georgia,serif"><span style="color:rgb(0,132,0);font-family:Menlo;font-size:11px" class=""><br class=""></span></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="color:rgb(186,45,162)" class="">import</span> Foundation</div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: Helvetica; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="color:rgb(186,45,162)" class="">protocol</span> NameProtocol {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="color:rgb(186,45,162)" class="">var</span> name:<span style="color:rgb(112,61,170)" class="">String</span> { <span style="color:rgb(186,45,162)" class="">get</span> }</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: Helvetica; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);" class=""><span style="color:rgb(186,45,162)" class="">struct</span><span style="" class=""> Cat:</span>NameProtocol<span style="" class=""> {</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="color:rgb(186,45,162)" class="">let</span> name:<span style="color:rgb(112,61,170)" class="">String</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: Helvetica; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);" class=""><span style="color:rgb(186,45,162)" class="">struct</span><span style="" class=""> Dog:</span>NameProtocol<span style="" class=""> {</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="color:rgb(186,45,162)" class="">let</span> name: <span style="color:rgb(112,61,170)" class="">String</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: Helvetica; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="color:rgb(186,45,162)" class="">enum</span> AnimalType {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="color:rgb(186,45,162)" class="">case</span> catType(cat:<span style="color:rgb(79,129,135)" class="">NameProtocol</span>)</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="color:rgb(186,45,162)" class="">case</span> dogType(dog:<span style="color:rgb(79,129,135)" class="">NameProtocol</span>)</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: Helvetica; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="color:rgb(186,45,162)" class="">struct</span> Animal {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="color:rgb(186,45,162)" class="">let</span> type:<span style="color:rgb(79,129,135)" class="">AnimalType</span></div><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class="">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="color:rgb(186,45,162)" class="">func</span> printName() {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:rgb(186,45,162)" class="">switch</span> <span style="color:rgb(79,129,135)" class="">type</span> {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color:rgb(186,45,162)" class="">case</span><span style="" class=""> .</span><span style="color:rgb(49,89,93)" class="">catType</span><span style="" class="">(</span><span style="color:rgb(186,45,162)" class="">let</span><span style="" class=""> </span><span style="text-decoration: underline;" class="">a</span><span style="" class="">nimal), </span>// matching a protocol value in multiple patterns is not yet supported; use separate cases instead</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color:rgb(49,89,93)" class="">dogType</span>(<span style="color:rgb(186,45,162)" class="">let</span> animal):</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:rgb(62,30,129)" class="">print</span>(animal.<span style="color:rgb(79,129,135)" class="">name</span>)</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; }</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: Helvetica; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="color:rgb(186,45,162)" class="">let</span> cat = <span style="color:rgb(79,129,135)" class="">Cat</span>(name: <span style="color:rgb(209,47,27)" class="">"kitty"</span>)</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="color:rgb(186,45,162)" class="">let</span> catType = <span style="color:rgb(79,129,135)" class="">AnimalType</span>.<span style="color:rgb(49,89,93)" class="">catType</span>(cat: <span style="color:rgb(79,129,135)" class="">cat</span>)</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="color:rgb(186,45,162)" class="">let</span> animal = <span style="color:rgb(79,129,135)" class="">Animal</span>(type: <span style="color:rgb(79,129,135)" class="">catType</span>)</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(49, 89, 93);" class=""><span style="color:rgb(79,129,135)" class="">animal</span><span style="" class="">.</span>printName<span style="" class="">()</span></div></div><div class="gmail_default" style="font-family:georgia,serif"><br class=""></div><div class="gmail_default" style="font-family:georgia,serif"><span style="color:rgb(0,132,0);font-family:Menlo;font-size:11px" class=""><br class=""></span></div><div class="gmail_default"><font face="georgia, serif" class="">I am wondering which&nbsp;proposal&nbsp;this is? And will it be implemented in Swift 4.0? I search the error as keywords, but didn't get the expected results.</font></div></div></div></blockquote><br class=""></div><div>It’s mostly just a bug. In Swift 3.1 this code was accepted but <b class="">did the wrong thing</b>&nbsp;at run-time. So we put in the error message until we can get around to fixing that, which at this point is unlikely to happen for Swift 4. There’s no new proposal needed, just more time to work on it.</div><div><br class=""></div><div>Sorry for the inconvenience,</div><div>Jordan</div><br class=""></body></html>