REPL silently hides the fact that rendering of large structures are elided (no ... is shown as in Scala2 REPL)
See original GitHub issueCompiler 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.
Issue Analytics
- State:
- Created 3 years ago
- Comments:17 (9 by maintainers)
Top Results From Across the Web
The REPL | Scala 3 — Book
The REPL is a command-line interpreter, so it sits there waiting for you to type something. Now you can type Scala expressions to...
Read more >Warts of the Scala Programming Language
This post will explore some of what, in my opinion, are the warts of the Scala programming language, to hopefully raise awareness of...
Read more >scala - REPL warning on using structural types - Stack Overflow
The warning suggests viewing the Scaladoc page, which says. Why control it? Reflection is not available on all platforms.
Read more >Untitled
Luxemburger hof bous events, No trigger be honest zip, Gasper vs hampper, ... Rel-4p32-sc replacement, Zenidim blog, San andreas fault plate boundary, ...
Read more >Compile-time Safety and Runtime Performance in ...
As a consequence of the large number of possible message interleavings in a real distributed application, certain paths through an execution.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
So this is a deeper collection rendering issue to take in Scala 2. But I think making the REPL not creating surprise as my fix fixes, is good, even if it does not fix the deeper issue…
Thanks. That is more how than why. Maybe anything less than a show typeclass will be a limited solution.
https://github.com/scala/bug/issues/11785#issuecomment-755003346