Skip to content

Commit 9769fbd

Browse files
oderskysmarter
authored andcommitted
Don't suppress stacktraces when testing pickler
1 parent ad6b578 commit 9769fbd

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

compiler/src/dotty/tools/dotc/core/Mode.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,13 @@ object Mode {
8181
/** Read original positions when unpickling from TASTY */
8282
val ReadPositions = newMode(16, "ReadPositions")
8383

84+
/** Don't suppress exceptions thrown during show */
85+
val PrintShowExceptions = newMode(17, "PrintShowExceptions")
86+
8487
val PatternOrType = Pattern | Type
8588

8689
/** We are elaborating the fully qualified name of a package clause.
8790
* In this case, identifiers should never be imported.
8891
*/
89-
val InPackageClauseName = newMode(17, "InPackageClauseName")
92+
val InPackageClauseName = newMode(18, "InPackageClauseName")
9093
}

compiler/src/dotty/tools/dotc/printing/Formatting.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ object Formatting {
3131
case arg: Showable =>
3232
try arg.show
3333
catch {
34-
case NonFatal(ex) => s"[cannot display due to $ex, raw string = $toString]"
34+
case NonFatal(ex) if !ctx.mode.is(Mode.PrintShowExceptions) =>
35+
s"[cannot display due to $ex, raw string = $toString]"
3536
}
3637
case _ => arg.toString
3738
}

compiler/src/dotty/tools/dotc/transform/Pickler.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ class Pickler extends Phase {
7979
ctx.fresh
8080
.setPeriod(Period(ctx.runId + 1, FirstPhaseId))
8181
.setReporter(new ThrowingReporter(ctx.reporter))
82-
.addMode(Mode.ReadPositions))
82+
.addMode(Mode.ReadPositions)
83+
.addMode(Mode.PrintShowExceptions))
8384
result
8485
}
8586

0 commit comments

Comments
 (0)