Skip to content

Commit 2a5171b

Browse files
committed
Driver: properly use root Context passed as argument
Also do not try to initialize the definitions in the context used by partest, this is not necessary and I suspect that this is what lead to the test failures.
1 parent 7fb9551 commit 2a5171b

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

src/dotty/tools/dotc/Driver.scala

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,10 @@ abstract class Driver extends DotClass {
3333
protected def sourcesRequired = true
3434

3535
def setup(args: Array[String], rootCtx: Context): (List[String], Context) = {
36-
val summary = CompilerCommand.distill(args)(rootCtx)
37-
// FIXME: We should reuse rootCtx instead of creating newCtx, but this
38-
// makes some tests fail with "denotation module _root_ invalid in run 2."
39-
val newCtx = initCtx.setCompilerCallback(rootCtx.compilerCallback)
40-
implicit val ctx: Context = newCtx.fresh.setSettings(summary.sstate)
41-
val fileNames = CompilerCommand.checkUsage(summary, sourcesRequired)
36+
val ctx = rootCtx.fresh
37+
val summary = CompilerCommand.distill(args)(ctx)
38+
ctx.setSettings(summary.sstate)
39+
val fileNames = CompilerCommand.checkUsage(summary, sourcesRequired)(ctx)
4240
(fileNames, ctx)
4341
}
4442

test/dotty/partest/DPDirectCompiler.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ class DPDirectCompiler(runner: DPTestRunner) extends nest.DirectCompiler(runner)
1515

1616
implicit val ctx: dotty.tools.dotc.core.Contexts.Context = {
1717
val base = new dotty.tools.dotc.core.Contexts.ContextBase
18-
val ctx = base.initialCtx.fresh
19-
base.definitions.init(ctx)
20-
ctx
18+
base.initialCtx.fresh
2119
}
2220

2321
try {

0 commit comments

Comments
 (0)