ScalaMock
ScalaMock copied to clipboard
"Error while emitting" on wrong mock usage
ScalaMock Version (e.g. 3.5.0)
5.2.0
Scala Version (e.g. 2.12)
2.13.12
Runtime (JVM or JS)
JVM
Reproducible Test Case
File for scala-cli:
//> using scala 2.13.12
//> using dep org.scalamock::scalamock:5.2.0
//> using dep org.scalatest::scalatest:3.2.17
//> using options -Vprint:typer
trait A1
trait A2
trait A {
def f(x: Int)(implicit a1: A1, a2: A2 = new A2 {})
}
import org.scalamock.scalatest.MockFactory
trait Test extends MockFactory {
val aMock = mock[A]
(aMock.f(_: Int)(_: A1)).expects(*, *) // here is a bug, A2 should be passed too
}
Please describe the expected behavior of the issue
Compilation fails with message, that A2 should be passed too.
Please provide a description of what actually happens
Compilation fails with unhelpful message:
scalac: Error while emitting Main.scala
value x$1
Original issue: https://github.com/scala/bug/issues/12924
Works with scala 3