Skip to content

Commit

Permalink
Set typer phase after InteractiveDriver.run
Browse files Browse the repository at this point in the history
Fixes #13467
  • Loading branch information
tgodzik committed Sep 14, 2021
1 parent 31292be commit 0add3d4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
Expand Up @@ -167,6 +167,7 @@ class InteractiveDriver(val settings: List[String]) extends Driver {
cleanup(t)
myOpenedTrees(uri) = topLevelTrees(t, source)
myCompilationUnits(uri) = unit
myCtx = myCtx.fresh.setPhase(myInitCtx.base.typerPhase.id)

reporter.removeBufferedMessages
}
Expand Down
Expand Up @@ -307,7 +307,7 @@ class DottyLanguageServer extends LanguageServer
val pos = sourcePosition(driver, uri, params.getPosition)
val items = driver.compilationUnits.get(uri) match {
case Some(unit) =>
val freshCtx = ctx.fresh.setPeriod(Period(ctx.runId, ctx.base.typerPhase.id)).setCompilationUnit(unit)
val freshCtx = ctx.fresh.setCompilationUnit(unit)
Completion.completions(pos)(using freshCtx)._2
case None => Nil
}
Expand Down
Expand Up @@ -842,4 +842,20 @@ class CompletionTest {
|object Main { "abc".xx${m1} }""".withSource
.completion(m1, Set())
}

@Test def concatMethodWithImplicits: Unit = {
code"""|object A {
| Array.concat${m1}
|}""".withSource
.completion(
m1,
Set(
(
"concat",
Method,
"[T](xss: Array[T]*)(implicit evidence$11: scala.reflect.ClassTag[T]): Array[T]"
)
)
)
}
}

0 comments on commit 0add3d4

Please sign in to comment.