<div dir="ltr">Hi,<div><br></div><div><span style="font-size:12.8px">If I have the *same* extension in two *different* modules, ModuleA and ModuleB, and ModuleC uses both modules, but in *seperate* files, then there is still ambiguity about which extension to call:</span><div style="font-size:12.8px"><br></div><blockquote style="font-size:12.8px;margin:0px 0px 0px 40px;border:none;padding:0px">ModuleA<br><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">A.swift</blockquote><span class="gmail-im"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">public protocol P {</blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">func m() -&gt; String</blockquote></blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">}<br></blockquote></blockquote></span><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">extension Int: P {</blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">public func m() -&gt; String { <span style="font-size:12.8px">return &quot;AP.m&quot; </span><span style="font-size:12.8px">}</span></blockquote></blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">}<br></blockquote></blockquote></blockquote><blockquote style="font-size:12.8px;margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"></blockquote>ModuleB<br><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"></blockquote>B.swift<br><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><span class="gmail-im">public protocol P {<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">func m() -&gt; String</blockquote>}<br></span>extension Int: P {<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">public func m() -&gt; String { <span style="font-size:12.8px">return &quot;BP.m&quot; </span><span style="font-size:12.8px">}</span></blockquote>}<br></blockquote></blockquote></blockquote><blockquote style="font-size:12.8px;margin:0px 0px 0px 40px;border:none;padding:0px">ModuleC<br><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">A.swift</blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">import ModuleA</blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">func am(_ i: Int) -&gt; String { return i.m() }<br></blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">B.swift<br></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">import ModuleB</blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">func bm(_ i: Int) -&gt; String { return i.m() }<br></blockquote></blockquote></blockquote><blockquote style="font-size:12.8px;margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">main.swift<br></blockquote></blockquote><blockquote style="font-size:12.8px;margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"></blockquote></blockquote>let i = 0<br><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"></blockquote></blockquote>print(am(i))<br>print(bm(i))<br></blockquote></blockquote></blockquote><br style="font-size:12.8px"><span style="font-size:12.8px">Gives the following errors when built:</span><br style="font-size:12.8px"><div style="font-size:12.8px"><br></div><blockquote style="font-size:12.8px;margin:0px 0px 0px 40px;border:none;padding:0px">sunzero-ln:ModuleC lov080$ swift build<br>Fetching /Users/lov080/Google Drive/Swift/Examples/Example Module Clashes/ModuleA<br>Fetching /Users/lov080/Google Drive/Swift/Examples/Example Module Clashes/ModuleB<br>Cloning /Users/lov080/Google Drive/Swift/Examples/Example Module Clashes/ModuleA<br>Resolving /Users/lov080/Google Drive/Swift/Examples/Example Module Clashes/ModuleA at 1.0.0<br>Cloning /Users/lov080/Google Drive/Swift/Examples/Example Module Clashes/ModuleB<br>Resolving /Users/lov080/Google Drive/Swift/Examples/Example Module Clashes/ModuleB at 1.0.0<br>Compile Swift Module &#39;ModuleB&#39; (1 sources)<br>Compile Swift Module &#39;ModuleA&#39; (1 sources)<br>Compile Swift Module &#39;ModuleC&#39; (3 sources)<br>/Users/lov080/Google Drive/Swift/Examples/Example Module Clashes/ModuleC/Sources/B.<wbr>swift:3:38: error: ambiguous use of &#39;m()&#39;<br>func bm(_ i: Int) -&gt; String { return i.m() }<br>                                     ^<br>ModuleA.Int:2:17: note: found this candidate<br>    public func m() -&gt; String<br>                ^<br>ModuleB.Int:2:17: note: found this candidate<br>    public func m() -&gt; String<br>                ^<br>/Users/lov080/Google Drive/Swift/Examples/Example Module Clashes/ModuleC/Sources/A.<wbr>swift:3:38: error: ambiguous use of &#39;m()&#39;<br>func am(_ i: Int) -&gt; String { return i.m() }<br>                                     ^<br>ModuleA.Int:2:17: note: found this candidate<br>    public func m() -&gt; String<br>                ^<br>ModuleB.Int:2:17: note: found this candidate<br>    public func m() -&gt; String<br>                ^<br>&lt;unknown&gt;:0: error: build had 1 command failures<br>error: exit(1): /Applications/Xcode.app/<wbr>Contents/Developer/Toolchains/<wbr>XcodeDefault.xctoolchain/usr/<wbr>bin/swift-build-tool -f /Users/lov080/Google\ Drive/Swift/Examples/Example\ Module\ Clashes/ModuleC/.build/debug.<wbr>yaml<br><br></blockquote><span style="font-size:12.8px">Is this the expected behaviour or a bug?</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Thanks in advance for any help,</span></div><div><span style="font-size:12.8px"><br clear="all"></span><div><div class="gmail_signature">  -- Howard.<br></div></div>
</div></div>