<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi,<div class=""><br class=""></div><div class="">I would have expected that the following code reports an error, because</div><div class="">of ambiguous function overloads:<br class=""><div class=""><br class=""></div><div class=""><div style="margin: 0px; line-height: normal;" class=""><font face="Courier New" class="">infix operator ***: MultiplicationPrecedence</font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Courier New" class="">infix operator +++: AdditionPrecedence</font></div><div style="margin: 0px; line-height: normal; min-height: 14px;" class=""><font face="Courier New" class=""><br class=""></font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Courier New" class="">func ***(x: Int, y: Int) -&gt; String {</font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Courier New" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>print("f1")</font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Courier New" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>return ""</font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Courier New" class="">}</font></div><div style="margin: 0px; line-height: normal; min-height: 14px;" class=""><font face="Courier New" class=""><br class=""></font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Courier New" class="">func ***(x: Int, y: Int) -&gt; Int {</font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Courier New" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>print("f2")</font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Courier New" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>return 0</font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Courier New" class="">}</font></div><div style="margin: 0px; line-height: normal; min-height: 14px;" class=""><font face="Courier New" class=""><br class=""></font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Courier New" class="">func +++(x: String, y: Int) -&gt; Int {</font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Courier New" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>print("f3")</font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Courier New" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>return 0</font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Courier New" class="">}</font></div><div style="margin: 0px; line-height: normal; min-height: 14px;" class=""><font face="Courier New" class=""><br class=""></font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Courier New" class="">func +++(x: Int, y: Int) -&gt; Int {</font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Courier New" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>print("f4")</font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Courier New" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>return 0</font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Courier New" class="">}</font></div><div style="margin: 0px; line-height: normal; min-height: 14px;" class=""><font face="Courier New" class=""><br class=""></font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Courier New" class="">let result = 0 *** 4 +++ 0<span class="Apple-tab-span" style="white-space:pre">                </span>// prints f2 and f4</font></div></div><div class=""><br class=""></div></div><div class=""><br class=""></div><div class="">As far as I can tell, there are two possible overload resolutions: f1 + f3 or f2 + f4.</div><div class="">I thought that these two solutions get an "equivalent score" and therefore there would</div><div class="">be a compile error. However, that's not the case. Instead, the type checker picks</div><div class="">f2 and f4.</div><div class=""><br class=""></div><div class="">So, I guess my question is, whether there is some rule, that prefers</div><div class="">operators, which have the same argument types and the same return type</div><div class="">or whether this is simply a bug.</div><div class=""><br class=""></div><div class="">Thanks and best regards,</div><div class="">Toni</div></body></html>