Skip to content

Do not perform completion on higher kinded trees #13700

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions compiler/src/dotty/tools/dotc/interactive/Completion.scala
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,12 @@ object Completion {
val completions = path match {
// Ignore synthetic select from `This` because in code it was `Ident`
// See example in dotty.tools.languageserver.CompletionTest.syntheticThis
case Select(qual @ This(_), _) :: _ if qual.span.isSynthetic => completer.scopeCompletions
case Select(qual, _) :: _ => completer.selectionCompletions(qual)
case Import(expr, _) :: _ => completer.directMemberCompletions(expr)
case (_: untpd.ImportSelector) :: Import(expr, _) :: _ => completer.directMemberCompletions(expr)
case _ => completer.scopeCompletions
case Select(qual @ This(_), _) :: _ if qual.span.isSynthetic => completer.scopeCompletions
case Select(qual, _) :: _ if qual.tpe.hasSimpleKind => completer.selectionCompletions(qual)
case Select(qual, _) :: _ => Map.empty
case Import(expr, _) :: _ => completer.directMemberCompletions(expr)
case (_: untpd.ImportSelector) :: Import(expr, _) :: _ => completer.directMemberCompletions(expr)
case _ => completer.scopeCompletions
}

val describedCompletions = describeCompletions(completions)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,4 @@ class CustomCompletionTests extends DottyTest:

assert(offset == prefix.length)
assert(labels.contains("scala.Function2"))

Original file line number Diff line number Diff line change
Expand Up @@ -887,4 +887,12 @@ class CompletionTest {
)
)
}

@Test def i12465_hkt: Unit =
code"""???.asInstanceOf[scala.collection.Seq].${m1}""".withSource
.completion(m1, Set())

@Test def i12465_hkt_alias: Unit =
code"""???.asInstanceOf[Seq].${m1}""".withSource
.completion(m1, Set())
}