Skip to content
Open
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
9 changes: 2 additions & 7 deletions compiler/src/dotty/tools/dotc/util/Signatures.scala
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ object Signatures {
case other => other.stripAnnots

/**
* Checks if tree is valid for signatureHelp. Skipped trees are either tuple or function applies
* Checks if tree is valid for signatureHelp. Skips tuple apply trees
*
* @param tree tree to validate
*/
Expand All @@ -389,12 +389,7 @@ object Signatures {
&& tree.symbol.exists
&& ctx.definitions.isTupleClass(tree.symbol.owner.companionClass)

val isFunctionNApply =
tree.symbol.name == nme.apply
&& tree.symbol.exists
&& ctx.definitions.isFunctionSymbol(tree.symbol.owner)

!isTupleApply && !isFunctionNApply
!isTupleApply

/**
* Get unapply method result type omiting unknown types and another method calls.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1610,3 +1610,39 @@ class SignatureHelpSuite extends BaseSignatureHelpSuite:
| ^^^^^^
""".stripMargin
)

@Test def `proper-function-signature` =
check(
"""
|object OOO {
|
|val function: (x: Int, y: String) => Unit =
|(_, _) =>
| ()
|
|function(@@, "one")
|}
""".stripMargin,
"""|apply(v1: Int, v2: String): Unit
| ^^^^^^^
|""".stripMargin
)

@Test def `proper-function-signature-with-explicit-apply` =
check(
"""
|object OOO {
|
|val function: (x: Int, y: String) => Unit =
|(_, _) =>
| ()
|
|function.apply(@@, "one")
|}
""".stripMargin,
"""|apply(v1: Int, v2: String): Unit
| ^^^^^^^
|""".stripMargin
)


Loading