Skip to content

Commit 2bc92db

Browse files
Use the new control syntax in Pickler and FrontEnd
1 parent 707d380 commit 2bc92db

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class Pickler extends Phase {
8989

9090
override def runOn(units: List[CompilationUnit])(using Context): List[CompilationUnit] = {
9191
val result = super.runOn(units)
92-
if (ctx.settings.YtestPickler.value)
92+
if ctx.settings.YtestPickler.value
9393
testUnpickler(
9494
using ctx.fresh
9595
.setPeriod(Period(ctx.runId + 1, FirstPhaseId))

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,10 @@ class FrontEnd extends Phase {
4040

4141
def monitor(doing: String)(body: => Unit)(using Context): Unit =
4242
try body
43-
catch {
43+
catch
4444
case NonFatal(ex) =>
4545
report.echo(s"exception occurred while $doing ${ctx.compilationUnit}")
4646
throw ex
47-
}
4847

4948
def parse(using Context): Unit = monitor("parsing") {
5049
val unit = ctx.compilationUnit
@@ -91,17 +90,16 @@ class FrontEnd extends Phase {
9190
}
9291

9392

94-
private def firstTopLevelDef(trees: List[tpd.Tree])(using Context): Symbol = trees match {
93+
private def firstTopLevelDef(trees: List[tpd.Tree])(using Context): Symbol = trees match
9594
case PackageDef(_, defs) :: _ => firstTopLevelDef(defs)
9695
case Import(_, _) :: defs => firstTopLevelDef(defs)
9796
case (tree @ TypeDef(_, _)) :: _ => tree.symbol
9897
case _ => NoSymbol
99-
}
10098

10199
protected def discardAfterTyper(unit: CompilationUnit)(using Context): Boolean =
102100
unit.isJava || unit.suspended
103101

104-
override def runOn(units: List[CompilationUnit])(using Context): List[CompilationUnit] = {
102+
override def runOn(units: List[CompilationUnit])(using Context): List[CompilationUnit] =
105103
val unitContexts =
106104
for unit <- units yield
107105
report.inform(s"compiling ${unit.source}")
@@ -113,7 +111,7 @@ class FrontEnd extends Phase {
113111
enterSyms(using remaining.head)
114112
remaining = remaining.tail
115113

116-
if (firstXmlPos.exists && !defn.ScalaXmlPackageClass.exists)
114+
if firstXmlPos.exists && !defn.ScalaXmlPackageClass.exists then
117115
report.error("""To support XML literals, your project must depend on scala-xml.
118116
|See https://github.com/scala/scala-xml for more information.""".stripMargin,
119117
firstXmlPos)
@@ -132,14 +130,13 @@ class FrontEnd extends Phase {
132130
| ${suspendedUnits.toList}%, %
133131
|"""
134132
val enableXprintSuspensionHint =
135-
if (ctx.settings.XprintSuspension.value) ""
133+
if ctx.settings.XprintSuspension.value then ""
136134
else "\n\nCompiling with -Xprint-suspension gives more information."
137135
report.error(em"""Cyclic macro dependencies $where
138136
|Compilation stopped since no further progress can be made.
139137
|
140138
|To fix this, place macros in one set of files and their callers in another.$enableXprintSuspensionHint""")
141139
newUnits
142-
}
143140

144141
def run(using Context): Unit = unsupported("run")
145142
}

0 commit comments

Comments
 (0)