Skip to content

Commit 0bec5ad

Browse files
committed
Workaround missing complitions due to non-backportable change in the upstream. Update CompletionTests
1 parent 65645e5 commit 0bec5ad

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,7 +1659,7 @@ class CompletionTest {
16591659
|""".completion(m1, Set(
16601660
("Number", Field, "scala.util.matching.Regex"),
16611661
("NumberFormatException", Module, "NumberFormatException"),
1662-
("Numeric", Field, "scala.math.Numeric")
1662+
("Numeric", Method, "=> scala.math.Numeric.type")
16631663
))
16641664

16651665
@Test def shadowedImportType: Unit =
@@ -1677,6 +1677,6 @@ class CompletionTest {
16771677
("NumberFormatException", Module, "NumberFormatException"),
16781678
("NumberFormatException", Field, "NumberFormatException"),
16791679
("Numeric", Field, "Numeric"),
1680-
("Numeric", Field, "scala.math.Numeric")
1680+
("Numeric", Method, "=> scala.math.Numeric.type")
16811681
))
16821682
}

presentation-compiler/src/main/dotty/tools/pc/completions/Completions.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,11 @@ class Completions(
233233
): List[CompletionValue] =
234234
val sym = denot.symbol
235235
// find the apply completion that would need a snippet
236+
// <accessor> handling is LTS specific: It's a workaround to mittigate lack of https://github.com/scala/scala3/pull/18874 backport
237+
// which was required in backport of https://github.com/scala/scala3/pull/18914 to achive the improved completions semantics.
236238
val methodDenots: List[SingleDenotation] =
237239
if shouldAddSnippet && completionMode.is(Mode.Term) &&
238-
(sym.is(Flags.Module) || sym.isField || sym.isClass && !sym.is(Flags.Trait)) && !sym.is(Flags.JavaDefined)
240+
(sym.isOneOf(Flags.Module | Flags.Accessor) || sym.isField || sym.isClass && !sym.is(Flags.Trait)) && !sym.is(Flags.JavaDefined)
239241
then
240242
val info =
241243
/* Companion will be added even for normal classes now,

0 commit comments

Comments
 (0)