A misleading title, I think, at least with regard to the actual code that you are trying to do.
Help type inferencer ...
object A extends App { val x = Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Array[Nothing]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]() println(x) }
This compiles just fine and works just fine (I donβt even need to change the JVM options):
$ time scalac -d classes A.scala real 0m5.179s $ time scala -cp classes A [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[Ljava.lang.Object;@872380 real 0m2.461s
So, this is more about compiling and type inference, including in REPL (which rewrites code and recompiles). It seems that REPL is trying to work somewhere after the kernelrouter phase (tried using scala -Xprint:all ).
source share