diff --git a/presentation-compiler/src/main/dotty/tools/pc/completions/Completions.scala b/presentation-compiler/src/main/dotty/tools/pc/completions/Completions.scala index 007fe45541b6..d6ca15b35129 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/completions/Completions.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/completions/Completions.scala @@ -244,7 +244,7 @@ class Completions( */ if sym.isClass && sym.companionModule.exists then sym.companionModule.info else denot.info - val applyDenots = info.member(nme.apply).allSymbols.map(_.asSingleDenotation) + val applyDenots = info.member(nme.apply).allSymbols.map(_.asSeenFrom(info).asSingleDenotation) denot :: applyDenots else denot :: Nil diff --git a/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionDocSuite.scala b/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionDocSuite.scala index 994dd15ea96f..45f07b5fb7b1 100644 --- a/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionDocSuite.scala +++ b/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionDocSuite.scala @@ -215,7 +215,7 @@ class CompletionDocSuite extends BaseCompletionSuite: """ |> Found documentation for scala/package.Vector. |Vector scala.collection.immutable - |Vector[A](elems: A*): CC[A] + |Vector[A](elems: A*): Vector[A] |""".stripMargin, includeDocs = true ) @@ -317,6 +317,6 @@ class CompletionDocSuite extends BaseCompletionSuite: |} """.stripMargin, """|myNumbers: Vector[Int] - |myNumbers(i: Int): A + |myNumbers(i: Int): Int |""".stripMargin ) diff --git a/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionSuite.scala b/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionSuite.scala index 274320276a56..8f47582e4806 100644 --- a/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionSuite.scala +++ b/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionSuite.scala @@ -27,10 +27,10 @@ class CompletionSuite extends BaseCompletionSuite: |}""".stripMargin, """ |List scala.collection.immutable - |List[A](elems: A*): CC[A] + |List[A](elems: A*): List[A] |List - java.awt |List - java.util - |ListMap[K, V](elems: (K, V)*): CC[K, V] + |ListMap[K, V](elems: (K, V)*): ListMap[K, V] |""".stripMargin, topLines = Some(5) ) @@ -180,7 +180,7 @@ class CompletionSuite extends BaseCompletionSuite: | TrieMap@@ |}""".stripMargin, """|TrieMap scala.collection.concurrent - |TrieMap[K, V](elems: (K, V)*): CC[K, V] + |TrieMap[K, V](elems: (K, V)*): TrieMap[K, V] |""".stripMargin ) @@ -1712,3 +1712,25 @@ class CompletionSuite extends BaseCompletionSuite: |""".stripMargin ) + @Test def `instantiate-type-vars-in-extra-apply-completions` = + check( + """|object M: + | val fooBar = List(123) + | foo@@ + |""".stripMargin, + """|fooBar: List[Int] + |fooBar(n: Int): Int + |""".stripMargin + ) + + @Test def `show-underlying-type-instead-of-CC` = + check( + """|object M: + | List@@ + |""".stripMargin, + """|List[A](elems: A*): List[A] + |ListMap[K, V](elems: (K, V)*): ListMap[K, V] + |""".stripMargin, + filter = _.contains("[") + ) + diff --git a/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionWorkspaceSuite.scala b/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionWorkspaceSuite.scala index 706ae5062308..713e60bd2fdd 100644 --- a/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionWorkspaceSuite.scala +++ b/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionWorkspaceSuite.scala @@ -790,7 +790,7 @@ class CompletionWorkspaceSuite extends BaseCompletionSuite: |""".stripMargin, """|fooBar: String |fooBar: List[Int] - |fooBar(n: Int): A + |fooBar(n: Int): Int |""".stripMargin, )