-
Notifications
You must be signed in to change notification settings - Fork 1.1k
REPL silently hides the fact that rendering of large structures are elided (no ... is shown as in Scala2 REPL) #11377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
We use scala.runtime.ScalaRunTime.replStringOf from the Scala 2 standard library to print things in the repl. What does Scala 2 use? Should replStringOf be changed to add the trailing dots? |
Scala 2: truncates with ...
Scala 3: does not:
|
It looks like the handling of the truncation and trailing dots is performed here in Scala 2.13.4: which I'm guessing happens after any call to |
Indeed if the Scala 2.13 REPL is started as |
So the bug should (also?) be reported in Scala2? |
And the Scala3 REPL should have the same settings logic as in the Scala 2 REPL? |
There seems to be two "settings" in play here:
|
I was bold and have fixed this (but not all the settings logic in Scala 2 of course). Is this PR ok?
|
That's a good catch! I haven't looked at Scala 3 yet, but I see in Scala 2 it limits what is rendered (of a huge iterable). So truncating after rendering isn't quite the same. Why doesn't |
I think Scala 2 truncates after rendering and then adds the |
For example, limit before rendering in
The heuristics are quite opaque, such as testing for xml classes. |
Aha. Yes, agree; |
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... |
I don't understand why the heuristic thinks this ought to OOM:
|
That |
|
Thanks. That is more how than why. Maybe anything less than a show typeclass will be a limited solution. |
fix #11377 truncate big output in REPL
Uh oh!
There was an error while loading. Please reload this page.
Compiler version
3.0.0-M4-bin-20210209-a66eaf3-NIGHTLY
Minimized code + Output
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.The text was updated successfully, but these errors were encountered: