@@ -6,8 +6,10 @@ import dotty.tools.pc.ScalaPresentationCompiler
6
6
import org .junit .{Before , Test }
7
7
8
8
import scala .language .unsafeNulls
9
- import scala .meta .internal .metals .EmptyCancelToken
10
9
import scala .meta .internal .metals .CompilerOffsetParams
10
+ import scala .meta .internal .metals .EmptyCancelToken
11
+ import scala .meta .internal .metals .EmptyReportContext
12
+ import scala .meta .internal .metals .PcQueryContext
11
13
import scala .meta .pc .OffsetParams
12
14
import scala .concurrent .Future
13
15
import scala .concurrent .Await
@@ -26,20 +28,22 @@ class CompilerCachingSuite extends BasePCSuite:
26
28
private def checkCompilationCount (expected : Int ): Unit =
27
29
presentationCompiler match
28
30
case pc : ScalaPresentationCompiler =>
29
- val compilations = pc.compilerAccess.withNonInterruptableCompiler(None )( - 1 , EmptyCancelToken ) { driver =>
31
+ val compilations = pc.compilerAccess.withNonInterruptableCompiler(- 1 , EmptyCancelToken ) { driver =>
30
32
driver.compiler().currentCtx.runId
31
- }.get(timeout.length, timeout.unit)
33
+ }(emptyQueryContext) .get(timeout.length, timeout.unit)
32
34
assertEquals(expected, compilations, s " Expected $expected compilations but got $compilations" )
33
35
case _ => throw IllegalStateException (" Presentation compiler should always be of type of ScalaPresentationCompiler" )
34
36
35
37
private def getContext (): Context =
36
38
presentationCompiler match
37
39
case pc : ScalaPresentationCompiler =>
38
- pc.compilerAccess.withNonInterruptableCompiler(None )( null , EmptyCancelToken ) { driver =>
40
+ pc.compilerAccess.withNonInterruptableCompiler(null , EmptyCancelToken ) { driver =>
39
41
driver.compiler().currentCtx
40
- }.get(timeout.length, timeout.unit)
42
+ }(emptyQueryContext) .get(timeout.length, timeout.unit)
41
43
case _ => throw IllegalStateException (" Presentation compiler should always be of type of ScalaPresentationCompiler" )
42
44
45
+ private def emptyQueryContext = PcQueryContext (None , () => " " )(using EmptyReportContext )
46
+
43
47
@ Before
44
48
def beforeEach : Unit =
45
49
presentationCompiler.restart()
0 commit comments