Skip to content

Commit 87456bb

Browse files
committed
Address PR comments.
1 parent 024b0ad commit 87456bb

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

compiler/src/dotty/tools/dotc/parsing/ParserPhase.scala

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,17 @@ import dotty.tools.unsupported
1414

1515
class Parser extends Phase {
1616

17-
override def phaseName: String = "parsing"
17+
override def phaseName: String = Parser.name
1818

1919
// We run TreeChecker only after type checking
2020
override def isCheckable: Boolean = false
2121

22-
override def isRunnable(implicit ctx: Context): Boolean = true
23-
2422
/** The position of the first XML literal encountered while parsing,
2523
* NoSourcePosition if there were no XML literals.
2624
*/
2725
private[dotc] var firstXmlPos: SourcePosition = NoSourcePosition
2826

29-
def parse(using Context) = monitor("parsing") {
27+
def parse(using Context) = monitor("parser") {
3028
val unit = ctx.compilationUnit
3129
unit.untpdTree =
3230
if (unit.isJava) new JavaParsers.JavaParser(unit.source).parse()
@@ -39,7 +37,7 @@ class Parser extends Phase {
3937
tree
4038
}
4139

42-
val printer = if (ctx.settings.Xprint.value.contains("parser")) default else typr
40+
val printer = if (ctx.settings.Xprint.value.contains(Parser.name)) default else typr
4341
printer.println("parsed:\n" + unit.untpdTree.show)
4442
if (Config.checkPositions)
4543
unit.untpdTree.checkPos(nonOverlapping = !unit.isJava && !ctx.reporter.hasErrors)
@@ -49,7 +47,7 @@ class Parser extends Phase {
4947
override def runOn(units: List[CompilationUnit])(using Context): List[CompilationUnit] = {
5048
val unitContexts =
5149
for unit <- units yield
52-
report.inform(s"running parser on ${unit.source}")
50+
report.inform(s"parsing ${unit.source}")
5351
ctx.fresh.setCompilationUnit(unit).withRootImports
5452

5553
unitContexts.foreach(parse(using _))
@@ -60,3 +58,7 @@ class Parser extends Phase {
6058

6159
def run(using Context): Unit = unsupported("run")
6260
}
61+
62+
object Parser{
63+
val name: String = "parser"
64+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ trait Checking {
795795
private def checkLegalImportOrExportPath(path: Tree, kind: String)(using Context): Unit = {
796796
checkStable(path.tpe, path.srcPos, kind)
797797
if (!ctx.isAfterTyper) Checking.checkRealizable(path.tpe, path.srcPos)
798-
if ctx.phase.isCheckable && !isIdempotentExpr(path) then
798+
if !isIdempotentExpr(path) then
799799
report.error(em"import prefix is not a pure expression", path.srcPos)
800800
}
801801

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ class TyperPhase extends Phase {
7676
val unitContexts =
7777
for unit <- units yield
7878
val newCtx = ctx.fresh.setPhase(this.start).setCompilationUnit(unit)
79+
report.inform(s"typing ${unit.source}")
7980
// TODO without this test, dotty.tools.repl.ScriptedTests fails. Not sure why.
8081
if (this.start > Periods.FirstPhaseId)
8182
newCtx.withRootImports

0 commit comments

Comments
 (0)