Skip to content
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

PC: Replace CC with underlying type in completions #19638

Merged
merged 1 commit into from
Feb 7, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down Expand Up @@ -317,6 +317,6 @@ class CompletionDocSuite extends BaseCompletionSuite:
|}
""".stripMargin,
"""|myNumbers: Vector[Int]
|myNumbers(i: Int): A
|myNumbers(i: Int): Int
|""".stripMargin
)
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
Expand Down Expand Up @@ -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
)

Expand Down Expand Up @@ -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("[")
)

Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ class CompletionWorkspaceSuite extends BaseCompletionSuite:
|""".stripMargin,
"""|fooBar: String
|fooBar: List[Int]
|fooBar(n: Int): A
|fooBar(n: Int): Int
|""".stripMargin,
)

Expand Down
Loading