I’m in the process of migrating Scala 2.13.14 code to Scala 3.3.3.
Whem file that used to compile ok in Scala 2, provides this error message:
Recursion limit exceeded.
Maybe there is an illegal cyclic reference?
If that's not the case, you could also try to increase the stacksize using the -Xss JVM option.
For the unprocessed stack trace, compile with -Yno-decode-stacktraces.
A recurring operation is (inner to outer):
subtype String & K <:< Nothing
subtype String & K <:< Nothing
subtype String <:< scala.collection.Map[? >: String & K <: String | K, String]#K
subtype String | K <:< scala.collection.Map[? >: String & K <: String | K, String]#K
subtype (String | K, String) <:< (scala.collection.Map[? >: String & K <: String | K, String]#K, String)
subtype ((scala.collection.Map[? >: String & K <: String | K, String]#K, String)) => (
K2, V2) <:< ((String | K, String)) => B
.map { v =>
Maybe it can be solved with some scalacOptions
.
It is a very simple source file that contains only:
object EstadoPoolsDB extends Logging {
....
}
trait EstadoPoolsDBInfoMBean {
def getStatus: String
}
class EstadoPoolsDBInfo extends EstadoPoolsDBInfoMBean {
override def getStatus: String = {
val status = EstadoPoolsDB.status
JsonWeb.toJsonString(status, Traducciones.traduccionesPorDefecto, false).toOption.getOrElse(status.toString())
}
}
Surprisingly, I have many other source files that don’t show this problem, even though they are more complicated.
Current scalacOptions:
scalacOptions := Seq(
"-deprecation",
"-explain",
"-feature",
"-language:higherKinds",
)
I’m using Java 21.
The default ThreadStackSize is 1024.
I’ve obtained this value by running:
java -XX:+PrintFlagsFinal -version | grep ThreadStackSize
I’ve checked that scalacOptions
doesn’t admit adding -ss2048
.
Any hint?