-
Notifications
You must be signed in to change notification settings - Fork 22
Implicit conversion never applied but influences type inference #12044
Copy link
Copy link
Open
scala/scala
#11053Labels
fixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)implicitinfertyper
Milestone
Description
reproduction steps
using Scala 2.13.2,
scala> class Bar
class Bar
scala> def f[F[_], A](v: F[A]) = v
def f[F[_], A](v: F[A]): F[A]
scala> implicit def barToList(b: Bar): List[Int] = List(42)
def barToList(b: Bar): List[Int]
scala> f(new Bar)
val res1: Any = Bar@56881196problem
I would expect implicit conversion would result in
scala> f[List, Int](new Bar)
val res2: List[Int] = List(42)
where the following is inferred
F[_] = List
A = Int
instead of actual
F[_] = Any
A = Nothing
Examining the output of -Xprint:typer shows the following implicit conversion never happend
f(barToList(new Bar()))
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
fixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)implicitinfertyper