Implicit conversion problem on Scala 3
keynmol opened this issue · 0 comments
keynmol commented
Here's a scastie: https://scastie.scala-lang.org/oS3IvTm8RLCaFxII64wkbw
Here's the code:
import com.eed3si9n.expecty.Expecty.expect
trait Eq[T] {
def eq(x: T, y: T): Boolean
}
object Eq {
implicit val eqInt: Eq[Int] = new Eq[Int] {
def eq(x: Int, y: Int) = (x - y) == 0
}
}
implicit class EqOps[T](i: T)(implicit eq: Eq[T]) {
def `===`(other: T) = eq.eq(i, other)
}
@main def hello =
expect(1 === 1)
And it fails with
Found: main$package.EqOps[Int]
Required: (implicit eq: Eq[Int]): main$package.EqOps[Int]
According to disneystreaming/weaver-test#313 it behaves differently on 2.13