-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Do not perform completion on higher kinded trees #13700
Conversation
case Select(qual, _) :: _ if !qual.tpe.hasSimpleKind => Map.empty | ||
case Select(qual, _) :: _ => completer.selectionCompletions(qual) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend swapping these 2 cases to avoid the unnecessary negation:
case Select(qual, _) :: _ if !qual.tpe.hasSimpleKind => Map.empty | |
case Select(qual, _) :: _ => completer.selectionCompletions(qual) | |
case Select(qual, _) :: _ if qual.tpe.hasSimpleKind => completer.selectionCompletions(qual) | |
case Select(qual, _) :: _ => Map.empty |
@@ -169,3 +169,21 @@ class CustomCompletionTests extends DottyTest: | |||
|
|||
assert(offset == prefix.length) | |||
assert(labels.contains("scala.Function2")) | |||
|
|||
@Test def i12465_hkt(): Unit = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move these tests to CompletionTest.scala
where they can be written in a much more concise way:
@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())
This solution was developed during the 6th issue spree in the collaboration of @ghostbuster91 @KacperFKorban and @mtk.
We followed suggestion from @anatoliykmetyuk that invalid trees as
???.asInstanceOf[Seq]
which would result in compilation error when submitted in repl shouldn't provide any completions.Proposed solution behaves consistently both for
???.asInstanceOf[Seq]
and???.asInstanceOf[scala.collection.Seq]
giving zero completions.This closes #12465