Following code imports the same symbol twice, because it imports two different objects which both export it:
<code>object Ext:
def backwards(s: String): String = s.reverse
object A:
export Ext.*
object B:
export Ext.*
import A.*
import B.*
backwards("Hello")
</code>
<code>object Ext:
def backwards(s: String): String = s.reverse
object A:
export Ext.*
object B:
export Ext.*
import A.*
import B.*
backwards("Hello")
</code>
object Ext:
def backwards(s: String): String = s.reverse
object A:
export Ext.*
object B:
export Ext.*
import A.*
import B.*
backwards("Hello")
The error is:
Reference to backwards is ambiguous.
It is both imported by import A._
and imported subsequently by import B._
It is the same symbol eventually, therefore there is in fact no ambiguity, but I guess some implementations details of export
hide this from the compiler.
How can I solve this?
Motivation: In my project I have several objects which all export a set of useful extension functions so that anyone using any of those objects can use those extensions without having to import them explicitly.