Closed valencik closed 8 months ago
Happens also on 3.4.1-RC1-bin-20240131-2b40f55-NIGHTLY
I should add that you don't need the typeCheckErrors
to get this behaviour.
Given the following:
import scala.annotation.implicitNotFound
@implicitNotFound("Can you see me?!")
trait Compare[A, B]
object minimunit {
def assertEquals[A, B](
a: A,
b: B,
// The presence of the below default argument prevents the `implicitNotFound` message from appearing
// in the error output of `typeCheckErrors` in Scala +3.1.3
clue: => Any = "values are not the same"
)(implicit comp: Compare[A, B]): Unit = ()
}
object example extends App {
minimunit.assertEquals(true, 1)
}
On +3.1.3 we get a compile error:
[error] missing argument for parameter comp of method assertEquals in object minimunit: (implicit comp: Compare[Boolean, Int]): Unit
[error] minimunit.assertEquals(true, 1)
[error] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
And on 3.1.2 we see the implicitNotFound
instead:
[error] Can you see me?!
[error] minimunit.assertEquals(true, 1)
[error] ^
@Kordyjan should I open another issue for the solution in https://github.com/scala/scala3/pull/19737 to be back ported to a Scala LTS version?
Compiler version
3.1.3+ (3.1.2 is the last version where the
implicitNotFound
is not ignored)Minimized code
Output
Scala 3.1.3
scala-cli run --scala-version 3.1.3 minimunit.scala
Scala 3.1.2
scala-cli run --scala-version 3.1.2 minimunit.scala
Expectation
The
implicitNotFound
message should appear whether or not there is a default argument involved.If we remove the
clue: => Any = "values are not the same"
line, theimplicitNotFound
message is again returned on Scala versions greater than 3.1.2I encountered this issue when trying to upgrade munit to Scala 3.3.1 https://github.com/scalameta/munit/pull/733