Closed
Description
Compiler version
3.0.0
Minimized code
package repro
export wrap.Wrap as Wrap
export wrap.lift as lift
// separate issue: trying to define this at top-level errors out in other ways.
object wrap:
opaque type Wrap[V, T] = V
extension[V, T](w: Wrap[V, T])
def value: V = w
extension[V](v: V)
def lift[T]: Wrap[V, T] = v
end wrap
object conversions:
given g[T]: scala.Conversion[Wrap[Double, T], Wrap[Double, String]] =
new scala.Conversion[Wrap[Double, T], Wrap[Double, String]]:
def apply(w: Wrap[Double, T]): Wrap[Double, String] =
(w.value * 2).lift[String]
Output
scala> val t: Wrap[Double, String] = 1D.lift[Int]
1 |val t: Wrap[Double, String] = 1D.lift[Int]
| ^^^^^^^^^^^^
|Found: repro.wrap.Wrap[Double, Int]
|Required: repro.Wrap²[Double, String]
|
|where: Wrap is a type in object wrap with bounds <: [V, T] =>> Any
| Wrap² is a type in package object wrap$package which is an alias of [V, T] =>> repro.wrap.Wrap[V, T]
Expectation
I would expect scala to understand that repro.wrap.Wrap
and repro.Wrap
are the same thing, and not error out.