Skip to content

Commit 2fef5b8

Browse files
committed
Fix SignatureHelpSuite tparam5/last-arg1
1 parent 53ba3c8 commit 2fef5b8

File tree

2 files changed

+54
-2
lines changed

2 files changed

+54
-2
lines changed

compiler/src/dotty/tools/dotc/util/Signatures.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ object Signatures {
651651
*
652652
* @param err The error message to inspect.
653653
* @param params The parameters that were given at the call site.
654-
* @param alreadyCurried Index of paramss we are currently in.
654+
* @param paramssIndex Index of paramss we are currently in.
655655
*
656656
* @return A pair composed of the index of the best alternative (0 if no alternatives
657657
* were found), and the list of alternatives.

presentation-compiler/test/dotty/tools/pc/tests/signaturehelp/SignatureHelpSuite.scala

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package dotty.tools.pc.tests.signaturehelp
22

33
import dotty.tools.pc.base.BaseSignatureHelpSuite
44

5-
import org.junit.Test
5+
import org.junit.{ Ignore, Test }
66

77
class SignatureHelpSuite extends BaseSignatureHelpSuite:
88

@@ -253,6 +253,20 @@ class SignatureHelpSuite extends BaseSignatureHelpSuite:
253253
)
254254

255255
@Test def `tparam5` =
256+
check(
257+
"""
258+
|object a {
259+
| List[Int](1).lengthCompare(@@)
260+
|}
261+
""".stripMargin,
262+
"""|lengthCompare(len: Int): Int
263+
| ^^^^^^^^
264+
|lengthCompare(that: Iterable[?]): Int
265+
|""".stripMargin
266+
)
267+
268+
@Ignore("See if applyCallInfo can still inform on lengthCompare's sig, even if recv is in error")
269+
@Test def `tparam5_TypeMismatch` =
256270
check(
257271
"""
258272
|object a {
@@ -265,6 +279,31 @@ class SignatureHelpSuite extends BaseSignatureHelpSuite:
265279
|""".stripMargin
266280
)
267281

282+
@Test def `tparam5_nonvarargs` =
283+
check(
284+
"""
285+
|object a {
286+
| Option[Int](1).getOrElse(@@)
287+
|}
288+
""".stripMargin,
289+
"""|getOrElse[B >: Int](default: => B): B
290+
| ^^^^^^^^^^^^^
291+
|""".stripMargin
292+
)
293+
294+
@Ignore("Similar to `tparam5_TypeMismatch`")
295+
@Test def `tparam5_nonvarargs_TypeMismatch` =
296+
check(
297+
"""
298+
|object a {
299+
| Option[String](1).getOrElse(@@)
300+
|}
301+
""".stripMargin,
302+
"""|getOrElse[B >: String](default: => B): B
303+
| ^^^^^^^^^^^^^
304+
|""".stripMargin
305+
)
306+
268307
@Test def `error1` =
269308
check(
270309
"""
@@ -547,6 +586,19 @@ class SignatureHelpSuite extends BaseSignatureHelpSuite:
547586
)
548587

549588
@Test def `last-arg1` =
589+
check(
590+
"""
591+
|object A {
592+
| List[Int](1).map(a => @@)
593+
|}
594+
""".stripMargin,
595+
"""|map[B](f: Int => B): List[B]
596+
| ^^^^^^^^^^^
597+
|""".stripMargin
598+
)
599+
600+
@Ignore("Similar to `tparam5_TypeMismatch`")
601+
@Test def `last-arg1_TypeMismatch` =
550602
check(
551603
"""
552604
|object A {

0 commit comments

Comments
 (0)