Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implicit conversion problem on Scala 3 #50

Closed
keynmol opened this issue May 29, 2021 · 0 comments · Fixed by #51
Closed

Implicit conversion problem on Scala 3 #50

keynmol opened this issue May 29, 2021 · 0 comments · Fixed by #51

Comments

@keynmol
Copy link
Collaborator

keynmol commented May 29, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant