Skip to content

Commit bc68d6c

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

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,14 @@ class Completions(
231231
label: String,
232232
toCompletionValue: (String, SingleDenotation, CompletionSuffix) => CompletionValue
233233
): List[CompletionValue] =
234-
val sym = denot.symbol
234+
// Workaround for LTS due to lack of https://github.com/scala/scala3/pull/18874 backport
235+
// required after backport of https://github.com/scala/scala3/pull/18914
236+
// We use the symbol of accessor result type to make the sym compliant with the 3.4+
237+
// where we would obtain the field symbol directly
238+
val sym =
239+
val resultTpeSym = denot.info.finalResultType.typeSymbol
240+
if denot.symbol.is(Accessor) && resultTpeSym != NoSymbol then resultTpeSym
241+
else denot.symbol
235242
// find the apply completion that would need a snippet
236243
// <accessor> handling is LTS specific: It's a workaround to mittigate lack of https://github.com/scala/scala3/pull/18874 backport
237244
// which was required in backport of https://github.com/scala/scala3/pull/18914 to achive the improved completions semantics.

0 commit comments

Comments
 (0)