aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dotty/tools/dotc/Driver.scala10
-rw-r--r--test/dotty/partest/DPDirectCompiler.scala6
-rw-r--r--test/test/CompilerTest.scala4
3 files changed, 8 insertions, 12 deletions
diff --git a/src/dotty/tools/dotc/Driver.scala b/src/dotty/tools/dotc/Driver.scala
index 1627b6e48..57fa4a052 100644
--- a/src/dotty/tools/dotc/Driver.scala
+++ b/src/dotty/tools/dotc/Driver.scala
@@ -33,12 +33,10 @@ abstract class Driver extends DotClass {
protected def sourcesRequired = true
def setup(args: Array[String], rootCtx: Context): (List[String], Context) = {
- val summary = CompilerCommand.distill(args)(rootCtx)
- // FIXME: We should reuse rootCtx instead of creating newCtx, but this
- // makes some tests fail with "denotation module _root_ invalid in run 2."
- val newCtx = initCtx.setCompilerCallback(rootCtx.compilerCallback)
- implicit val ctx: Context = newCtx.fresh.setSettings(summary.sstate)
- val fileNames = CompilerCommand.checkUsage(summary, sourcesRequired)
+ val ctx = rootCtx.fresh
+ val summary = CompilerCommand.distill(args)(ctx)
+ ctx.setSettings(summary.sstate)
+ val fileNames = CompilerCommand.checkUsage(summary, sourcesRequired)(ctx)
(fileNames, ctx)
}
diff --git a/test/dotty/partest/DPDirectCompiler.scala b/test/dotty/partest/DPDirectCompiler.scala
index a6f11ec64..4e563820f 100644
--- a/test/dotty/partest/DPDirectCompiler.scala
+++ b/test/dotty/partest/DPDirectCompiler.scala
@@ -5,7 +5,7 @@ import scala.tools.partest.{ TestState, nest }
import java.io.{ File, PrintWriter, FileWriter }
-/* NOTE: Adapted from partest.DirectCompiler and DottyTest */
+/* NOTE: Adapted from partest.DirectCompiler */
class DPDirectCompiler(runner: DPTestRunner) extends nest.DirectCompiler(runner) {
override def compile(opts0: List[String], sources: List[File]): TestState = {
@@ -15,9 +15,7 @@ class DPDirectCompiler(runner: DPTestRunner) extends nest.DirectCompiler(runner)
implicit val ctx: dotty.tools.dotc.core.Contexts.Context = {
val base = new dotty.tools.dotc.core.Contexts.ContextBase
- val ctx = base.initialCtx.fresh
- base.definitions.init(ctx)
- ctx
+ base.initialCtx.fresh
}
try {
diff --git a/test/test/CompilerTest.scala b/test/test/CompilerTest.scala
index c65710e7d..526392576 100644
--- a/test/test/CompilerTest.scala
+++ b/test/test/CompilerTest.scala
@@ -33,7 +33,7 @@ import org.junit.Test
* object Test { def main(args: Array[String]): Unit = ... }
* Classpath jars can be added to partestDeps in the sbt Build.scala.
*/
-abstract class CompilerTest extends DottyTest {
+abstract class CompilerTest {
/** Override with output dir of test so it can be patched. Partest expects
* classes to be in partest-generated/[kind]/[testname]-[kind].obj/ */
@@ -181,7 +181,7 @@ abstract class CompilerTest extends DottyTest {
private def compileArgs(args: Array[String], xerrors: Int = 0)(implicit defaultOptions: List[String]): Unit = {
val allArgs = args ++ defaultOptions
val processor = if (allArgs.exists(_.startsWith("#"))) Bench else Main
- val nerrors = processor.process(allArgs, ctx).errorCount
+ val nerrors = processor.process(allArgs).errorCount
assert(nerrors == xerrors, s"Wrong # of errors. Expected: $xerrors, found: $nerrors")
}