Skip to content

Commit f1ed7c8

Browse files
committed
Fix tests
1 parent b1d5bdb commit f1ed7c8

20 files changed

+41
-19
lines changed

compiler/src/dotty/tools/dotc/Run.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint
7474
.addMode(Mode.ImplicitsEnabled)
7575
.setTyperState(ctx.typerState.fresh(ctx.reporter))
7676
ctx.initialize()(using start) // re-initialize the base context with start
77-
atPeriod(start.period) {
77+
atPeriod(ctx.period) {
7878
def addImport(ctx: Context, rootRef: ImportInfo.RootRef) =
7979
ctx.fresh.setImportInfo(ImportInfo.rootImport(rootRef))
8080
defn.RootImportFns.foldLeft(start.setRun(this))(addImport)

compiler/src/dotty/tools/repl/ReplCompiler.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,10 @@ class ReplCompiler extends Compiler {
4747
def importContext(imp: tpd.Import)(using Context, CState) =
4848
ctx.importContext(imp, imp.symbol)
4949

50-
def importPreviousRun(id: Int)(using Context, CState) = {
50+
def importPreviousRun(id: Int)(using Context, CState): Context = {
5151
// we first import the wrapper object id
5252
val path = nme.EMPTY_PACKAGE ++ "." ++ objectNames(id)
5353
def importWrapper(c: Context, importGiven: Boolean) = {
54-
assertSamePeriod()
5554
val importInfo = ImportInfo.rootImport(() =>
5655
requiredModuleRef(path), importGiven)(using c, c.cstate)
5756
c.fresh.setNewScope.setImportInfo(importInfo)

compiler/test/dotty/tools/CheckTypesTests.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import org.junit.Assert.{ assertFalse, assertTrue, fail }
55

66
import dotc.ast.Trees._
77
import dotc.core.Decorators._
8-
import dotc.core.Contexts.{Context, ctx}
8+
import dotc.core.Contexts._
99

1010
class CheckTypeTest extends DottyTest {
1111
@Test
@@ -29,6 +29,7 @@ class CheckTypeTest extends DottyTest {
2929
checkTypes(source, types: _*) {
3030
case (List(a, b, lu, li, lr, ls, la, lb), context) =>
3131
given Context = context
32+
given CState = context.cstate
3233

3334
assertTrue ( b <:< a)
3435
assertTrue (li <:< lu)
@@ -61,6 +62,7 @@ class CheckTypeTest extends DottyTest {
6162
checkTypes(source, List(typesA, typesB)) {
6263
case (List(sups, subs), context) =>
6364
given Context = context
65+
given CState = context.cstate
6466

6567
sups.lazyZip(subs).foreach { (sup, sub) => assertTrue(sub <:< sup) }
6668

compiler/test/dotty/tools/DottyTest.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ trait DottyTest extends ContextEscapeDetection {
8383
checkCompile("typer", gatheredSource) {
8484
(tree, context) =>
8585
given Context = context
86+
given CState = context.cstate
87+
8688
val findValDef: (List[tpd.ValDef], tpd.Tree) => List[tpd.ValDef] =
8789
(acc , tree) => {
8890
tree match {

compiler/test/dotty/tools/DottyTypeStealer.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package dotty.tools
33
import dotc.ast.tpd
44
import dotc.core.Names._
55
import dotc.ast.tpd._
6-
import dotc.core.Contexts.Context
6+
import dotc.core.Contexts._
77
import dotc.core.Decorators._
88
import dotc.core.Types.Type
99

@@ -17,6 +17,7 @@ object DottyTypeStealer extends DottyTest {
1717
checkCompile("typer", gatheredSource) {
1818
(tree, context) =>
1919
given Context = context
20+
given CState = context.cstate
2021
val findValDef: (List[ValDef], tpd.Tree) => List[ValDef] =
2122
(acc , tree) => tree match {
2223
case t: ValDef if t.name.startsWith(dummyName) => t :: acc

compiler/test/dotty/tools/backend/jvm/DottyBytecodeTest.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ package backend.jvm
44

55
import vulpix.TestConfiguration
66

7-
import dotc.core.Contexts.{Context, ContextBase, ctx}
7+
import dotc.core.Contexts._
88
import dotc.core.Comments.{ContextDoc, ContextDocstrings}
99
import dotc.core.Phases.Phase
1010
import dotc.Compiler
@@ -59,6 +59,7 @@ trait DottyBytecodeTest {
5959
/** Checks source code from raw strings */
6060
def checkBCode(scalaSources: List[String], javaSources: List[String] = Nil)(checkOutput: AbstractFile => Unit): Unit = {
6161
given Context = initCtx
62+
given CState = initCtx.cstate
6263

6364
val compiler = new Compiler
6465
val run = compiler.newRun

compiler/test/dotty/tools/dotc/ast/DesugarTests.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import org.junit.Assert._
1111
class DesugarTests extends DottyTest {
1212
import tpd._
1313

14-
private def validSym(sym: Symbol)(using Context): Unit = {
14+
private def validSym(sym: Symbol)(using Context, CState): Unit = {
1515
assert(
1616
// remaining symbols must be either synthetic:
1717
sym.is(Synthetic) ||
@@ -24,6 +24,7 @@ class DesugarTests extends DottyTest {
2424
@Test def caseClassHasCorrectMembers: Unit =
2525
checkCompile("typer", "case class Foo(x: Int, y: String)") { (tree, context) =>
2626
given Context = context
27+
given CState = context.cstate
2728
val ccTree = tree.find(tree => tree.symbol.name == typeName("Foo")).get
2829
val List(_, foo) = defPath(ccTree.symbol, tree).map(_.symbol.info)
2930

@@ -39,6 +40,7 @@ class DesugarTests extends DottyTest {
3940
@Test def caseClassCompanionHasCorrectMembers: Unit =
4041
checkCompile("typer", "case class Foo(x: Int, y: String)") { (tree, context) =>
4142
given Context = context
43+
given CState = context.cstate
4244
val ccTree = tree.find(tree => tree.symbol.name == termName("Foo")).get
4345
val List(_, foo) = defPath(ccTree.symbol, tree).map(_.symbol.info)
4446

compiler/test/dotty/tools/dotc/ast/TreeInfoTest.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import core.StdNames.nme
88
import core.Types._
99
import core.Symbols._
1010
import org.junit.Assert._
11-
import core.Contexts.{Context, ctx}
11+
import core.Contexts._
1212

1313
class TreeInfoTest extends DottyTest {
1414

@@ -18,6 +18,7 @@ class TreeInfoTest extends DottyTest {
1818
def testDefPath: Unit = checkCompile("typer", "class A { def bar = { val x = { val z = 0; 0} }} ") {
1919
(tree, context) =>
2020
given Context = context
21+
given CState = context.cstate
2122
val xTree = tree.find(tree => tree.symbol.name == termName("x")).get
2223
val path = defPath(xTree.symbol, tree)
2324
assertEquals(List(

compiler/test/dotty/tools/dotc/classpath/ZipAndJarFileLookupFactoryTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import org.junit.Test
44
import java.nio.file._
55
import java.nio.file.attribute.FileTime
66

7-
import dotty.tools.dotc.core.Contexts.{Context, ContextBase, CState, ctx}
7+
import dotty.tools.dotc.core.Contexts._
88
import dotty.tools.io.AbstractFile
99

1010

compiler/test/dotty/tools/dotc/parsing/DeSugarTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import ast.Trees._
1010
import ast.desugar
1111
import ast.desugar._
1212
import core.Mode
13-
import Contexts.{Context, CState}
13+
import Contexts._
1414

1515
import scala.collection.mutable.ListBuffer
1616

0 commit comments

Comments
 (0)