File tree Expand file tree Collapse file tree 2 files changed +38
-7
lines changed
compiler/src/dotty/tools/dotc/util
presentation-compiler/test/dotty/tools/pc/tests/signaturehelp Expand file tree Collapse file tree 2 files changed +38
-7
lines changed Original file line number Diff line number Diff line change @@ -379,7 +379,7 @@ object Signatures {
379
379
case other => other.stripAnnots
380
380
381
381
/**
382
- * Checks if tree is valid for signatureHelp. Skipped trees are either tuple or function applies
382
+ * Checks if tree is valid for signatureHelp. Skips tuple apply trees
383
383
*
384
384
* @param tree tree to validate
385
385
*/
@@ -389,12 +389,7 @@ object Signatures {
389
389
&& tree.symbol.exists
390
390
&& ctx.definitions.isTupleClass(tree.symbol.owner.companionClass)
391
391
392
- val isFunctionNApply =
393
- tree.symbol.name == nme.apply
394
- && tree.symbol.exists
395
- && ctx.definitions.isFunctionSymbol(tree.symbol.owner)
396
-
397
- ! isTupleApply && ! isFunctionNApply
392
+ ! isTupleApply
398
393
399
394
/**
400
395
* Get unapply method result type omiting unknown types and another method calls.
Original file line number Diff line number Diff line change @@ -1610,3 +1610,39 @@ class SignatureHelpSuite extends BaseSignatureHelpSuite:
1610
1610
| ^^^^^^
1611
1611
""" .stripMargin
1612
1612
)
1613
+
1614
+ @ Test def `proper-function-signature` =
1615
+ check(
1616
+ """
1617
+ |object OOO {
1618
+ |
1619
+ |val function: (x: Int, y: String) => Unit =
1620
+ |(_, _) =>
1621
+ | ()
1622
+ |
1623
+ |function(@@, "one")
1624
+ |}
1625
+ """ .stripMargin,
1626
+ """ |apply(v1: Int, v2: String): Unit
1627
+ | ^^^^^^^
1628
+ |""" .stripMargin
1629
+ )
1630
+
1631
+ @ Test def `proper-function-signature-with-explicit-apply` =
1632
+ check(
1633
+ """
1634
+ |object OOO {
1635
+ |
1636
+ |val function: (x: Int, y: String) => Unit =
1637
+ |(_, _) =>
1638
+ | ()
1639
+ |
1640
+ |function.apply(@@, "one")
1641
+ |}
1642
+ """ .stripMargin,
1643
+ """ |apply(v1: Int, v2: String): Unit
1644
+ | ^^^^^^^
1645
+ |""" .stripMargin
1646
+ )
1647
+
1648
+
You can’t perform that action at this time.
0 commit comments