Skip to content

Commit 847c110

Browse files
committed
Run Frontend regardless of parsing errors
1 parent 7fc1c2d commit 847c110

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,17 @@ import Symbols._
99
import config.Config
1010
import config.Printers.{typr, default}
1111
import util.Stats._
12-
import ast.Trees._
12+
import ast.{tpd, Trees}
13+
import Trees._
1314

1415
class FrontEnd extends Phase {
16+
import tpd._
1517

1618
override def phaseName: String = FrontEnd.name
1719
override def isTyper: Boolean = true
18-
import ast.tpd
20+
21+
// Run regardless of parsing errors
22+
override def isRunnable(implicit ctx: Context): Boolean = true
1923

2024
override def allowsImplicitSearch: Boolean = true
2125

@@ -42,7 +46,7 @@ class FrontEnd extends Phase {
4246
record("retained typed trees after typer", unit.tpdTree.treeSize)
4347
}
4448

45-
private def firstTopLevelDef(trees: List[tpd.Tree])(implicit ctx: Context): Symbol = trees match {
49+
private def firstTopLevelDef(trees: List[Tree])(implicit ctx: Context): Symbol = trees match {
4650
case PackageDef(_, defs) :: _ => firstTopLevelDef(defs)
4751
case Import(_, _) :: defs => firstTopLevelDef(defs)
4852
case (tree @ TypeDef(_, _)) :: _ => tree.symbol
@@ -58,14 +62,14 @@ class FrontEnd extends Phase {
5862
ctx.fresh.setCompilationUnit(unit)
5963
}
6064

61-
record("parsedTrees", ast.Trees.ntrees)
65+
record("parsedTrees", Trees.ntrees)
6266
remaining = unitContexts
6367
while (remaining.nonEmpty) {
6468
enterSyms(remaining.head)
6569
remaining = remaining.tail
6670
}
6771
unitContexts.foreach(typeCheck(_))
68-
record("total trees after typer", ast.Trees.ntrees)
72+
record("total trees after typer", Trees.ntrees)
6973
unitContexts.map(_.compilationUnit).filterNot(discardAfterTyper)
7074
}
7175

0 commit comments

Comments
 (0)