Closed
Description
The following code compiles in Scalac, but Dotty produces an error without message when compiled with -language:Scala2
:
// dotc -d out -language:Scala2 examples/matcher.scala
trait Matchers { matchers =>
private sealed trait Collected extends Product with Serializable
def foo[T](collected: Collected, xs: scala.collection.GenTraversable[T]): Int = 3
}
object Matchers extends Matchers
The problem is that RefChecks
does not take into acount that Collected
is visible in Matchers$
under Scala2 mode.
The missing error message is caused by the incorrect call getMessage
instead of toMessage
on TypeError.