Skip to content

Commit 3e96f81

Browse files
committed
tidy up
1 parent 411e018 commit 3e96f81

File tree

11 files changed

+15
-16
lines changed

11 files changed

+15
-16
lines changed

compiler/src/dotty/tools/dotc/CompilationUnit.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import core.Decorators._
1616
import config.{SourceVersion, Feature}
1717
import StdNames.nme
1818
import scala.annotation.internal.sharable
19-
import scala.util.control.ControlThrowable
2019
import transform.MacroAnnotations
2120

2221
class CompilationUnit protected (val source: SourceFile) {

compiler/src/dotty/tools/dotc/Driver.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package dotty.tools.dotc
33
import dotty.tools.FatalError
44
import config.CompilerCommand
55
import core.Comments.{ContextDoc, ContextDocstrings}
6-
import core.Contexts._, core.ContextOps._
6+
import core.Contexts._
77
import util.Implosion
88
import core.{MacroClassLoader, TypeError}
99
import dotty.tools.dotc.ast.Positioned

compiler/src/dotty/tools/dotc/Run.scala

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,12 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint
179179
compileSources(sources)
180180
catch
181181
case NonFatal(ex) =>
182-
if units.nonEmpty then report.echo(i"exception occurred while compiling $units%, %")
183-
else report.echo(s"exception occurred while compiling ${files.map(_.name).mkString(", ")}")
184-
throw ex
182+
try
183+
if units.nonEmpty then ctx.lateImplode(i"exception occurred while compiling $units%, %")
184+
else ctx.lateImplode(s"exception occurred while compiling ${files.map(_.name).mkString(", ")}")
185+
catch
186+
case _: Implosion =>
187+
185188
case _ : Implosion =>
186189
// All handling related to the Implosion is done during creation, so we can swallow this
187190

compiler/src/dotty/tools/dotc/cc/CaptureSet.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package dotc
33
package cc
44

55
import core.*
6-
import Types.*, Symbols.*, Flags.*, Contexts.*, ContextOps.*, Decorators.*
6+
import Types.*, Symbols.*, Flags.*, Contexts.*, Decorators.*
77
import config.Printers.capt
88
import Annotations.Annotation
99
import annotation.threadUnsafe

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,9 @@ import Contexts._, Symbols._, Types._, Flags._
55
import Denotations._, SymDenotations._
66
import Names.Name, StdNames.nme
77
import ast.untpd
8-
import util.*
9-
import scala.util.control.NonFatal
108

119
/** Extension methods for contexts where we want to keep the ctx.<methodName> syntax */
1210
object ContextOps:
13-
1411
extension (ctx: Context)
1512

1613
/** Enter symbol into current class, if current class is owner of current context,

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,9 @@ object Contexts {
482482
def lateImplode(cause: Throwable): Nothing =
483483
Implosion(Exception("Context was thrown away, this crash report may not be accurate", (cause)))(using ctx)
484484

485+
def lateImplode(msg: Any): Nothing =
486+
lateImplode(AssertionError(msg))
487+
485488
final def withOwner(owner: Symbol): Context =
486489
if (owner ne this.owner) fresh.setOwner(owner) else this
487490

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ import typer.ImportInfo.withRootImports
2121
import ast.{tpd, untpd}
2222
import scala.annotation.internal.sharable
2323
import scala.util.control.NonFatal
24-
import dotty.tools.dotc.core.ContextOps.*
25-
import dotty.tools.dotc.CompilationUnit.SuspendException
24+
2625

2726

2827
object Phases {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ object TypeApplications {
1818
type TypeParamInfo = ParamInfo.Of[TypeName]
1919

2020
/** Assert type is not a TypeBounds instance and return it unchanged */
21-
def noBounds(tp: Type)(using Context): Type = tp match {
22-
case tp: TypeBounds => ctx.implode("no TypeBounds allowed")
21+
def noBounds(tp: Type): Type = tp match {
22+
case tp: TypeBounds => throw new AssertionError("no TypeBounds allowed")
2323
case _ => tp
2424
}
2525

compiler/src/dotty/tools/dotc/report.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ object report:
7373
error(msg.toMessage, pos)
7474

7575
def error(msg: => String)(using Context): Unit =
76-
error(msg, NoSourcePosition) //why default to NoSourcePosition? Surely the caller should be encouraged to at least think about the position and specify NoSourcePosition if no sane position exists
76+
error(msg, NoSourcePosition)
7777

7878
def error(ex: TypeError, pos: SrcPos)(using Context): Unit =
7979
val fullPos = addInlineds(pos)

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import ContextFunctionResults._
3434
import ExplicitOuter._
3535
import core.Mode
3636
import util.Property
37-
3837
import reporting._
3938

4039
class Erasure extends Phase with DenotTransformer {

0 commit comments

Comments
 (0)