Open erikerlandson opened 1 year ago
package repro:
opaque type Repro = Int
object Repro:
def apply(v: Int): Repro = v
extension (f: Repro) def value: Int = f
object exporter:
export repro.Repro
object test:
import exporter.*
val x = Repro(1)
val v = x.value // error: does not recognize .value extension method
With val x = Repro(1)
we infer val x: repro.Test$package.Repro = exporter.Repro.apply(1)
. Note that we widen the exporter.Repro
to repro.Test$package.Repro
.
If we explicitly set val x: exporter.Repro = Repro(1)
or val x: repro.Repro = Repro(1)
it works.
is this type inference bug something that can be fixed?
Compiler version
3.2.2
Minimized code
Output
Compile failure: the
.value
extension method is not recognized when imported fromexporter
Expectation
Should compile correctly. I believe this may be a simplified reproducer for https://github.com/lampepfl/dotty/issues/17151