Closed
Description
Compiler version
3.0.0-M4-bin-20210209-a66eaf3-NIGHTLY
Minimized code + Output
scala> val xs = collection.immutable.ArraySeq.fill(100)(0)
scala> val ys = xs :+ 11111 // works as expected, last elem is 11111
val ys: scala.collection.immutable.ArraySeq[Int] = ArraySeq(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11111)
scala> val xs = collection.immutable.ArraySeq.fill(1000)(0)
scala> val ys = xs :+ 11111 // HERE THE LAST printed elem by the REPL echo is 0 (sic!)
val ys: scala.collection.immutable.ArraySeq[Int] = ArraySeq(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
[... many zeros and commas elided by me, the reporter]
0, 0, 0, 0, 0, 0, 0)
scala> ys.toString // but this works, last line of output is as expeced:
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11111)
This is happening because of this:
https://github.com/lampepfl/dotty/blob/a7cb965fc9b106c9c85965afed96bda34e9063f5/compiler/src/dotty/tools/repl/Rendering.scala#L32
Expectation
When large structures are elided the REPL printout should end with ...
as in Scala2 REPL to indicate that not everything is shown.
It is especially confusing that it ends with ,0)
instead of , ...
as this made me think that all elements where in the output.