Skip to content

Commit ec2e8dc

Browse files
committed
some fixes
1 parent 40cf56b commit ec2e8dc

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ object ContextOps:
2525
| message: ${ex.getMessage()}
2626
| cause: ${ex.getCause()}
2727
| (truncated) stack trace:
28-
| ${ex.getStackTrace().take(10).mkString("\n ")}
28+
| ${ex.getStackTrace().nn.take(10).nn.mkString("\n ")}
2929
|Sources:
30-
| ${ctx.base.sources.keysIterator.mkString("\n ")}
30+
| ${ctx.base.sources.keysIterator.mkString(":")}
3131
|Files:
32-
| ${ctx.base.files.keysIterator.mkString("\n ")}
32+
| ${ctx.base.files.keysIterator.mkString(":")}
3333
|Context:
3434
| phase: ${ctx.phase}
3535
| owner: ${ctx.owner}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import ast.{tpd, untpd}
2222
import scala.annotation.internal.sharable
2323
import scala.util.control.NonFatal
2424
import dotty.tools.dotc.core.ContextOps.*
25+
import dotty.tools.dotc.CompilationUnit.SuspendException
2526

2627

2728
object Phases {
@@ -324,9 +325,9 @@ object Phases {
324325
units.map { unit =>
325326
val unitCtx = ctx.fresh.setPhase(this.start).setCompilationUnit(unit).withRootImports
326327
try run(using unitCtx)
327-
catch case ex: Throwable =>
328+
catch case ex: Throwable if !(ex.isInstanceOf[Implosion] || ex.isInstanceOf[SuspendException]) =>
328329
unitCtx.implode(i"$ex while running $phaseName on $unit", ex)
329-
throw ex
330+
330331
unitCtx.compilationUnit
331332
}
332333

compiler/src/dotty/tools/dotc/typer/ReTyper.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,12 @@ class ReTyper(nestingLevel: Int = 0) extends Typer(nestingLevel) with ReChecking
126126
override def typedUnadapted(tree: untpd.Tree, pt: Type, locked: TypeVars)(using Context): Tree =
127127
try super.typedUnadapted(tree, pt, locked)
128128
catch {
129-
case NonFatal(ex) =>
129+
case NonFatal(ex) if ctx.phase != Phases.typerPhase && ctx.phase != Phases.inliningPhase =>
130+
ctx.implode(
131+
i"exception while typing $tree of class ${tree.getClass} # ${tree.uniqueId}",
132+
ex
133+
)
130134

131-
val message = if ctx.phase != Phases.typerPhase && ctx.phase != Phases.inliningPhase then
132-
i"exception while typing $tree of class ${tree.getClass} # ${tree.uniqueId}"
133-
else ""
134-
ctx.implode(message, ex)
135135
}
136136

137137
override def inlineExpansion(mdef: DefDef)(using Context): List[Tree] = mdef :: Nil

0 commit comments

Comments
 (0)