@@ -937,7 +937,122 @@ class InlayHintsSuite extends BaseInlayHintsSuite {
937937 | given A = A()
938938 | implicit def bar(using a: A): B[A] = B[A]()
939939 | def foo(using b: B[A]): String = "aaa"
940- | val g: String = foo/*(using bar<<(5:15)>>)*/
940+ | val g: String = foo/*(using bar<<(5:15)>>(given_A<<(4:8)>>) )*/
941941 |""" .stripMargin
942942 )
943+
944+ @ Test def `multiple-params-list` =
945+ check(
946+ """ |object Main {
947+ | case class A()
948+ | case class B()
949+ | implicit val theA: A = A()
950+ | def foo(b: B)(implicit a: A): String = "aaa"
951+ | val g: String = foo(B())
952+ |}
953+ |""" .stripMargin,
954+ """ |object Main {
955+ | case class A()
956+ | case class B()
957+ | implicit val theA: A = A()
958+ | def foo(b: B)(implicit a: A): String = "aaa"
959+ | val g: String = foo(B())/*(using theA<<(4:15)>>)*/
960+ |}
961+ |""" .stripMargin,
962+ )
963+
964+ @ Test def `implicit-chain` =
965+ check(
966+ """ |object Main{
967+ | def hello()(implicit string: String, integer: Int, long: Long): String = {
968+ | println(s"Hello $string, $long, $integer!")
969+ | }
970+ | implicit def theString(implicit i: Int): String = i.toString
971+ | implicit def theInt(implicit l: Long): Int = l
972+ | implicit val theLong: Long = 42
973+ | hello()
974+ |}
975+ |""" .stripMargin,
976+ """ |object Main{
977+ | def hello()(implicit string: String, integer: Int, long: Long): String = {
978+ | println(s"Hello $string, $long, $integer!")
979+ | }
980+ | implicit def theString(implicit i: Int): String = i.toString
981+ | implicit def theInt(implicit l: Long): Int = l
982+ | implicit val theLong: Long = 42
983+ | hello()/*(using theString<<(5:15)>>(theInt<<(6:15)>>(theLong<<(7:15)>>)), theInt<<(6:15)>>(theLong<<(7:15)>>), theLong<<(7:15)>>)*/
984+ |}
985+ |""" .stripMargin,
986+ )
987+
988+ @ Test def `implicit-parameterless-def` =
989+ check(
990+ """ |object Main{
991+ | def hello()(implicit string: String, integer: Int, long: Long): String = {
992+ | println(s"Hello $string, $long, $integer!")
993+ | }
994+ | implicit def theString(implicit i: Int): String = i.toString
995+ | implicit def theInt: Int = 43
996+ | implicit def theLong: Long = 42
997+ | hello()
998+ |}
999+ |""" .stripMargin,
1000+ """ |object Main{
1001+ | def hello()(implicit string: String, integer: Int, long: Long): String = {
1002+ | println(s"Hello $string, $long, $integer!")
1003+ | }
1004+ | implicit def theString(implicit i: Int): String = i.toString
1005+ | implicit def theInt: Int = 43
1006+ | implicit def theLong: Long = 42
1007+ | hello()/*(using theString<<(5:15)>>(theInt<<(6:15)>>), theInt<<(6:15)>>, theLong<<(7:15)>>)*/
1008+ |}
1009+ |""" .stripMargin,
1010+ )
1011+
1012+ @ Test def `implicit-fn` =
1013+ check(
1014+ """ |object Main{
1015+ | implicit def stringLength(s: String): Int = s.length
1016+ | implicitly[String => Int]
1017+ |
1018+ | implicit val namedStringLength: String => Long = (s: String) => s.length.toLong
1019+ | implicitly[String => Long]
1020+ |}
1021+ |""" .stripMargin,
1022+ """ |object Main{
1023+ | implicit def stringLength(s: String): Int = s.length
1024+ | implicitly[String => Int]
1025+ |
1026+ | implicit val namedStringLength: String => Long = (s: String) => s.length.toLong
1027+ | implicitly[String => Long]/*(using namedStringLength<<(5:15)>>)*/
1028+ |}
1029+ |""" .stripMargin,
1030+ )
1031+
1032+ @ Test def `implicit-fn2` =
1033+ check(
1034+ """ |object Main{
1035+ | implicit def stringLength(s: String, i: Int): Int = s.length
1036+ | implicitly[(String, Int) => Int]
1037+ |}
1038+ |""" .stripMargin,
1039+ """ |object Main{
1040+ | implicit def stringLength(s: String, i: Int): Int = s.length
1041+ | implicitly[(String, Int) => Int]
1042+ |}
1043+ |""" .stripMargin,
1044+ )
1045+
1046+ @ Test def `strip-margin` =
1047+ check(
1048+ """ |object Main{
1049+ | "".stripMargin
1050+ |}
1051+ |""" .stripMargin,
1052+ """ |package test
1053+ |object Main{
1054+ | /*augmentString<<scala/Predef.augmentString().>>(*/""/*)*/.stripMargin
1055+ |}
1056+ |""" .stripMargin
1057+ )
9431058}
0 commit comments