question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

REPL silently hides the fact that rendering of large structures are elided (no ... is shown as in Scala2 REPL)

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:17 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
bjornregnellcommented, Feb 10, 2021

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…

0reactions
som-snyttcommented, Feb 10, 2021

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found