Skip to content

Commit cf60061

Browse files
authored
Merge pull request #13534 from dotty-staging/backport-13530
[Backport] Set typer phase after InteractiveDriver.run
2 parents fe8debc + 0d1c25d commit cf60061

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

compiler/src/dotty/tools/dotc/interactive/InteractiveDriver.scala

+1
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ class InteractiveDriver(val settings: List[String]) extends Driver {
167167
cleanup(t)
168168
myOpenedTrees(uri) = topLevelTrees(t, source)
169169
myCompilationUnits(uri) = unit
170+
myCtx = myCtx.fresh.setPhase(myInitCtx.base.typerPhase)
170171

171172
reporter.removeBufferedMessages
172173
}

language-server/src/dotty/tools/languageserver/DottyLanguageServer.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import scala.io.Codec
1919
import dotc._
2020
import ast.{Trees, tpd, untpd}
2121
import core._, core.Decorators._
22-
import Comments._, Constants._, Contexts._, Flags._, Names._, NameOps._, Symbols._, SymDenotations._, Trees._, Types._, Periods._
22+
import Comments._, Constants._, Contexts._, Flags._, Names._, NameOps._, Symbols._, SymDenotations._, Trees._, Types._
2323
import classpath.ClassPathEntries
2424
import reporting._
2525
import typer.Typer
@@ -307,7 +307,7 @@ class DottyLanguageServer extends LanguageServer
307307
val pos = sourcePosition(driver, uri, params.getPosition)
308308
val items = driver.compilationUnits.get(uri) match {
309309
case Some(unit) =>
310-
val freshCtx = ctx.fresh.setPeriod(Period(ctx.runId, ctx.base.typerPhase.id)).setCompilationUnit(unit)
310+
val freshCtx = ctx.fresh.setCompilationUnit(unit)
311311
Completion.completions(pos)(using freshCtx)._2
312312
case None => Nil
313313
}

language-server/test/dotty/tools/languageserver/CompletionTest.scala

+16
Original file line numberDiff line numberDiff line change
@@ -857,4 +857,20 @@ class CompletionTest {
857857
|}""".withSource
858858
.completion(m1, Set(("show",Method, "(using x$2: x$1.reflect.Printer[x$1.reflect.Tree]): String")))
859859
}
860+
861+
@Test def concatMethodWithImplicits: Unit = {
862+
code"""|object A {
863+
| Array.concat${m1}
864+
|}""".withSource
865+
.completion(
866+
m1,
867+
Set(
868+
(
869+
"concat",
870+
Method,
871+
"[T](xss: Array[T]*)(implicit evidence$11: scala.reflect.ClassTag[T]): Array[T]"
872+
)
873+
)
874+
)
875+
}
860876
}

0 commit comments

Comments
 (0)