File tree Expand file tree Collapse file tree 3 files changed +31
-3
lines changed
compiler/src/dotty/tools/dotc/util
presentation-compiler/test/dotty/tools/pc Expand file tree Collapse file tree 3 files changed +31
-3
lines changed Original file line number Diff line number Diff line change @@ -196,7 +196,8 @@ object Signatures {
196196 fun : tpd.Tree ,
197197 isTypeApply : Boolean = false
198198 )(using Context ): (Int , Int , List [Signature ]) =
199- def treeQualifier (tree : tpd.Tree ): tpd.Tree = tree match
199+ def treeQualifier (tree : tpd.Tree ): tpd.Tree =
200+ tree match
200201 case Apply (qual, _) => treeQualifier(qual)
201202 case TypeApply (qual, _) => treeQualifier(qual)
202203 case AppliedTypeTree (qual, _) => treeQualifier(qual)
@@ -247,7 +248,9 @@ object Signatures {
247248 val alternativeSignatures = alternativesWithTypes
248249 .flatMap(toApplySignature(_, findOutermostCurriedApply(untpdPath), safeParamssListIndex))
249250
250- val finalParamIndex = currentParamsIndex + previousArgs
251+ val finalParamIndex =
252+ if currentParamsIndex == - 1 then - 1
253+ else previousArgs + currentParamsIndex
251254 (finalParamIndex, alternativeIndex, alternativeSignatures)
252255 else
253256 (0 , 0 , Nil )
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ abstract class BaseSignatureHelpSuite extends BasePCSuite:
4343 out
4444 .append(signature.getLabel)
4545 .append(" \n " )
46- if (result.getActiveSignature == i && result.getActiveParameter != null && signature.getParameters.size() > 0 ) {
46+ if (result.getActiveSignature == i && result.getActiveParameter != null && result.getActiveParameter() >= 0 && signature.getParameters.size() > 0 ) {
4747 val param = signature.getParameters.get(result.getActiveParameter)
4848 val label = param.getLabel.getLeft()
4949 /* We need to find the label of the active parameter and show ^ at that spot
Original file line number Diff line number Diff line change @@ -1533,3 +1533,28 @@ class SignatureHelpSuite extends BaseSignatureHelpSuite:
15331533 |foo(i: Boolean, s: String)(b: Int): Unit
15341534 |""" .stripMargin
15351535 )
1536+
1537+ @ Test def `proper-param-empty-list` =
1538+ check(
1539+ """
1540+ |object x {
1541+ | def foo[K, V](): Unit = ???
1542+ | foo(@@)
1543+ |}
1544+ |""" .stripMargin,
1545+ " foo[K, V](): Unit"
1546+ )
1547+
1548+ @ Test def `proper-param-list-after-param-empty-list` =
1549+ check(
1550+ """
1551+ |object x {
1552+ | def foo[K, V]()(x: Int): Unit = ???
1553+ | foo()(@@)
1554+ |}
1555+ |""" .stripMargin,
1556+ """
1557+ |foo[K, V]()(x: Int): Unit
1558+ | ^^^^^^
1559+ """ .stripMargin
1560+ )
You can’t perform that action at this time.
0 commit comments