Skip to content

Commit

Permalink
Workaround missing complitions due to non-backportable change in the …
Browse files Browse the repository at this point in the history
…upstream. Update CompletionTests
  • Loading branch information
WojciechMazur committed Jun 30, 2024
1 parent 65645e5 commit db9cec3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1659,7 +1659,7 @@ class CompletionTest {
|""".completion(m1, Set(
("Number", Field, "scala.util.matching.Regex"),
("NumberFormatException", Module, "NumberFormatException"),
("Numeric", Field, "scala.math.Numeric")
("Numeric", Method, "=> scala.math.Numeric.type")
))

@Test def shadowedImportType: Unit =
Expand All @@ -1677,6 +1677,6 @@ class CompletionTest {
("NumberFormatException", Module, "NumberFormatException"),
("NumberFormatException", Field, "NumberFormatException"),
("Numeric", Field, "Numeric"),
("Numeric", Field, "scala.math.Numeric")
("Numeric", Method, "=> scala.math.Numeric.type")
))
}
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,14 @@ class Completions(
label: String,
toCompletionValue: (String, SingleDenotation, CompletionSuffix) => CompletionValue
): List[CompletionValue] =
val sym = denot.symbol
// Workaround for LTS due to lack of https://github.com/scala/scala3/pull/18874 backport
// required after backport of https://github.com/scala/scala3/pull/18914
// We use the symbol of accessor result type to make the sym compliant with the 3.4+
// where we would obtain the field symbol directly
val sym =
val resultTpeSym = denot.info.finalResultType.typeSymbol
if denot.symbol.is(Accessor) && resultTpeSym != NoSymbol then resultTpeSym
else denot.symbol
// find the apply completion that would need a snippet
val methodDenots: List[SingleDenotation] =
if shouldAddSnippet && completionMode.is(Mode.Term) &&
Expand Down

0 comments on commit db9cec3

Please sign in to comment.