Skip to content

Trim stack traces in REPL #10717

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

Merged
merged 2 commits into from
Dec 11, 2020
Merged

Conversation

som-snytt
Copy link
Contributor

Port the formatter from Scala 2, then use it in REPL exception handling.

(The formatter was ported in November and includes previous fix to how elided frames are counted.)

I didn't look into automated REPL output tests.

Starting scala3 REPL...
scala> ???
scala.NotImplementedError: an implementation is missing
  at scala.Predef$.$qmark$qmark$qmark(Predef.scala:345)
  ... 27 elided

scala> import scala.util.chaining._

scala> List(42).map(n => throw new IllegalArgumentException(n.toString).tap(_.addSuppressed(new RuntimeException("ouch"))))
java.lang.IllegalArgumentException: 42
  at rs$line$3$.$init$$$anonfun$2(rs$line$3:1)
  at rs$line$3$.$init$$$anonfun$adapted$1(rs$line$3:1)
  at scala.collection.immutable.List.map(List.scala:246)
  ... 27 elided
  Suppressed: java.lang.RuntimeException: ouch
    at rs$line$3$.$init$$$anonfun$1$$anonfun$1(rs$line$3:1)
    at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
    at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
    at scala.util.ChainingOps$.tap$extension(ChainingOps.scala:40)
    ... 30 more

scala> 

@som-snytt som-snytt marked this pull request as ready for review December 9, 2020 08:43
@som-snytt som-snytt force-pushed the forward/stack-formatter branch from 83892e4 to aef9913 Compare December 10, 2020 05:21
@som-snytt
Copy link
Contributor Author

Rebased on #10723

Copy link
Contributor

@anatoliykmetyuk anatoliykmetyuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise LGTM

@som-snytt som-snytt force-pushed the forward/stack-formatter branch from aef9913 to f1b53d3 Compare December 10, 2020 17:48
@smarter smarter merged commit 600c25c into scala:master Dec 11, 2020
@som-snytt som-snytt deleted the forward/stack-formatter branch December 11, 2020 16:33
@Kordyjan Kordyjan added this to the 3.0.0 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants