Closed
Description
Compiler version
3.3.1
Minimized code
object Module:
trait EntityDef:
type Id
type Record
type Entity = (Id, Record)
extension (e: Entity)
def updated: Entity = e
case class Exportee()
object Exportee extends EntityDef:
opaque type Id = Long
type Record = Exportee
def apply(id: Long): Entity = (id, Exportee())
object Client:
export Module.*
val x = Exportee(1L).updated
object ClientWorkingWithManualExport:
export Module.{Exportee as _, *}
type Exportee = Module.Exportee
val Exportee = Module.Exportee
val x = Exportee(1L).updated
Scastie https://scastie.scala-lang.org/QaKMJYEPQnumCasK5Ew7Cg
Output
Found: Playground.Client.Exportee.Entity
Required: ?{ updated: ? }
Note that implicit extension methods cannot be applied because they are ambiguous;
both method Exportee in object Client and object Exportee in object Module provide an extension method `updated` on Playground.Client.Exportee.Entity
Expectation
There should be no ambiguity resolving the extension method updated
. There is only one method and only one path to the method.
We can see in ClientWorkingWithManualExport
that when we "manually" create aliases to export Exportee, rather than via an export
statement, it compiles OK. In contrast, in Client
the same call fails to compile.