<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"><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=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; line-height: normal;" class="">Currently Swift is inconsistent on how it handles covariant return types, consider the code below:</div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div></div></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="color: rgb(187, 44, 162);" class="">class</span> Top {}</div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">class</span> Bottom: <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Top</span> {}</div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);" class="">protocol<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> P {</span></div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">func</span> mT() -&gt; <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Top</span></div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">typealias</span> A: Top</div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">func</span> mA() -&gt; <span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">A</span></div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">struct</span> S: <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">P</span> {</div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">func</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> mT() -&gt; </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Top</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> { </span>// Must be `Top` otherwise *type's declaration* gets error "does not conform to protocol P"</div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">return</span> <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Bottom</span>()</div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; }</div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">typealias</span> A = <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Top</span></div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">func</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> mA() -&gt; </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Top</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> { </span>// Must be `Top` otherwise *type's declaration* gets error "does not conform to protocol P"</div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">return</span> <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Bottom</span>()</div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; }</div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="color: rgb(187, 44, 162);" class="">class</span> BC&lt;G: Top&gt;: <span style="color: rgb(79, 129, 135);" class="">P</span> {</div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">func</span> mG() -&gt; <span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">G</span> {</div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(209, 47, 27);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #3d1d81" class="">fatalError</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">(</span>"Needs to be overridden"<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">)</span></div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; }</div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">func</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> mT() -&gt; </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Top</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> {&nbsp; </span>// Must be `Top` otherwise *type's declaration* gets error "does not conform to protocol P"</div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(209, 47, 27);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #3d1d81" class="">fatalError</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">(</span>"Needs to be overridden"<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">)</span></div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; }</div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">typealias</span> A = <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Top</span></div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">func</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> mA() -&gt; </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Top</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> { </span>// Must be `Top` otherwise *type's declaration* gets error "does not conform to protocol P"</div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(209, 47, 27);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #3d1d81" class="">fatalError</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">(</span>"Needs to be overridden"<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">)</span></div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; }</div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">class</span> DC: <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">BC</span>&lt;<span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Top</span>&gt; {</div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">override</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">func</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> mG() -&gt; </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Bottom</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> { </span>// Can be Bottom!</div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">return</span> <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Bottom</span>()</div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; }</div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">override</span> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">func</span> mT() -&gt; <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Bottom</span> { <span style="font-variant-ligatures: no-common-ligatures; color: #008400" class="">// Can be ottom!</span></div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">return</span> <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Bottom</span>()</div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; }</div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">override</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">func</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> mA() -&gt; </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Bottom</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> { </span>// Can be Bottom!</div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">return</span> <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Bottom</span>()</div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; }</div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div></div></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div></div></div></blockquote><div class="">The behaviour is odd in that if a class overrides a method from another class then covariant return types are allowed. However if a class or struct implements a method from a protocol then it can’t implement with a covariant return type.</div><div class=""><br class=""></div><div class="">When you implement a method with a protocol extension you get similar behaviour in that a class that overrides the already implemented behaviour can <i class="">now</i> have a covariant return type:</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);" class="">protocol<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> PE {</span></div></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">func</span> mT() -&gt; <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Top</span></div></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);" class="">extension<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">PE</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> {</span></div></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">func</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> mT() -&gt; </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Top</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> { </span>// Must be `Top` otherwise **compiler crashes** (seg. fault: 11)</div></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(209, 47, 27);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #3d1d81" class="">fatalError</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">(</span>"Needs to be overridden"<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">)</span></div></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; }</div></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">class</span> CE: <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">PE</span> {</div></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">func</span> mT() -&gt; <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Bottom</span> {&nbsp;<span style="color: rgb(0, 132, 0);" class="">// Can be Bottom!</span></div></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">return</span> <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Bottom</span>()</div></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; }</div></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div></div></blockquote><div class=""><br class=""></div><div class=""><br class=""></div><div class="">The suggestion is that like overrides, implementations of protocol methods can have covariant return types.</div><div class=""><br class=""></div><div class="">Thanks in advance for any comments,</div><div class=""><br class=""></div><div class="">&nbsp;— Howard.</div><div class=""><br class=""></div><div class="">PS another thing, though not part of the proposal, is that <i class="">not</i> requiring `override` when implementing a protocol method:&nbsp;</div><div class=""><br class=""></div><div class="">1. Is causing vague error messages and a compiler crash that do not finger the source of the problem.</div><div class="">2. Looks odd when some ‘inherited’ functions have override and other don’t,&nbsp;</div><div class="">3. Is inconsistent with other languages, i.e. Java (Java changed to @Override on interface methods - originally only on class methods - i.e. precedence for change), Scala, etc..</div><div class="">4. Is particularly jarring when an extension implements the method but then the overriding method <i class="">cannot</i> be marked with `override`.</div><div class=""><br class=""></div><div class="">PPS This proposal was originally part of “Protocols on Steroids” which was a collection of proposals that worked well together but comments indicated it would be easier to discuss as seperate proposals.</div><div class=""><br class=""></div>
<br class=""></body></html>