Skip to content

Commit ad92537

Browse files
committed
Fixes for printing under -Ytest-pickler
- Make printing package ids more robost Crashed before when printers were turned on during test pickling mode. - Make Denotation#bringForward more robost Assertion failed before when printers were turned on during test pickling mode.
1 parent 5b5b87c commit ad92537

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/dotty/tools/dotc/core/Denotations.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,8 @@ object Denotations {
601601
*/
602602
private def bringForward()(implicit ctx: Context): SingleDenotation = this match {
603603
case denot: SymDenotation if ctx.stillValid(denot) =>
604-
assert(ctx.runId > validFor.runId, s"denotation $denot invalid in run ${ctx.runId}. ValidFor: $validFor")
604+
assert(ctx.runId > validFor.runId || ctx.settings.YtestPickler.value, // mixing test pickler with debug printing can travel back in time
605+
s"denotation $denot invalid in run ${ctx.runId}. ValidFor: $validFor")
605606
var d: SingleDenotation = denot
606607
do {
607608
d.validFor = Period(ctx.period.runId, d.validFor.firstPhaseId, d.validFor.lastPhaseId)

src/dotty/tools/dotc/printing/RefinedPrinter.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
292292
}
293293

294294
def toTextPackageId(pid: Tree): Text =
295-
if (homogenizedView) toTextLocal(pid.tpe)
295+
if (homogenizedView && pid.hasType) toTextLocal(pid.tpe)
296296
else toTextLocal(pid)
297297

298298
var txt: Text = tree match {

0 commit comments

Comments
 (0)