Open
Description
Compiler version
2.13.16 and 3.6.3
Minimized code
- Compile the following code with Scala 2:
trait Tag
class Tagger[T](val value: T) extends AnyVal {
def withTag: T & Tag = ???
}
- Compile the following code with Scala 3:
object Main {
def main(arguments: Array[String]): Unit = {
val x = 2
println(new Tagger(x).withTag)
}
}
Output
Run the Scala 3 code and observe the following exception:
Exception in thread "main" java.lang.NoSuchMethodError: 'Tag Tagger$.withTag$extension(java.lang.Object)'
at Main$.main(Scala3.scala:5)
at Main.main(Scala3.scala)
Expectation
That NoSuchMethodError
wouldn't be thrown.