@@ -19,7 +19,7 @@ class InlayHintsSuite extends BaseInlayHintsSuite {
1919 | def foo()/*: Unit<<scala/Unit#>>*/ = {
2020 | implicit val imp: Int = 2
2121 | def addOne(x: Int)(implicit one: Int)/*: Int<<scala/Int#>>*/ = x + one
22- | val x/*: Int<<scala/Int#>>*/ = addOne(1)/*(imp<<(3:17)>>)*/
22+ | val x/*: Int<<scala/Int#>>*/ = addOne(1)/*(using imp<<(3:17)>>)*/
2323 | }
2424 |}
2525 |""" .stripMargin
@@ -66,7 +66,7 @@ class InlayHintsSuite extends BaseInlayHintsSuite {
6666 |object Main {
6767 | implicit val imp: Int = 2
6868 | def addOne(x: Int)(implicit one: Int)/*: Int<<scala/Int#>>*/ = x + one
69- | val x/*: Int<<scala/Int#>>*/ = addOne(1)/*(imp<<(3:15)>>)*/
69+ | val x/*: Int<<scala/Int#>>*/ = addOne(1)/*(using imp<<(3:15)>>)*/
7070 |}
7171 |""" .stripMargin
7272 )
@@ -100,7 +100,7 @@ class InlayHintsSuite extends BaseInlayHintsSuite {
100100 |object Main {
101101 | implicit val imp: Int = 2
102102 | def addOne(x: Int)(using one: Int)/*: Int<<scala/Int#>>*/ = x + one
103- | val x/*: Int<<scala/Int#>>*/ = addOne(1)/*(imp<<(3:15)>>)*/
103+ | val x/*: Int<<scala/Int#>>*/ = addOne(1)/*(using imp<<(3:15)>>)*/
104104 |}
105105 |""" .stripMargin
106106 )
@@ -502,7 +502,7 @@ class InlayHintsSuite extends BaseInlayHintsSuite {
502502 |}
503503 |""" .stripMargin,
504504 """ |object Main {
505- | val ordered/*: String<<scala/Predef.String#>>*/ = /*augmentString<<scala/Predef.augmentString().>>(*/"acb"/*)*/.sorted/*[Char<<scala/Char#>>]*//*(Char<<scala/math/Ordering.Char.>>)*/
505+ | val ordered/*: String<<scala/Predef.String#>>*/ = /*augmentString<<scala/Predef.augmentString().>>(*/"acb"/*)*/.sorted/*[Char<<scala/Char#>>]*//*(using Char<<scala/math/Ordering.Char.>>)*/
506506 |}
507507 |""" .stripMargin
508508 )
@@ -608,18 +608,18 @@ class InlayHintsSuite extends BaseInlayHintsSuite {
608608 |
609609 | /*StringTestOps<<(6:17)>>(*/"foo"/*)*/ should {
610610 | /*StringTestOps<<(6:17)>>(*/"checkThing1"/*)*/ in {
611- | checkThing1[String]/*(instancesString<<(10:15)>>)*/
612- | }/*(here<<(5:15)>>)*/
611+ | checkThing1[String]/*(using instancesString<<(10:15)>>)*/
612+ | }/*(using here<<(5:15)>>)*/
613613 | /*StringTestOps<<(6:17)>>(*/"checkThing2"/*)*/ in {
614- | checkThing2[String]/*(instancesString<<(10:15)>>, instancesString<<(10:15)>>)*/
615- | }/*(here<<(5:15)>>)*/
616- | }/*(subjectRegistrationFunction<<(3:15)>>)*/
614+ | checkThing2[String]/*(using instancesString<<(10:15)>>, instancesString<<(10:15)>>)*/
615+ | }/*(using here<<(5:15)>>)*/
616+ | }/*(using subjectRegistrationFunction<<(3:15)>>)*/
617617 |
618618 | /*StringTestOps<<(6:17)>>(*/"bar"/*)*/ should {
619619 | /*StringTestOps<<(6:17)>>(*/"checkThing1"/*)*/ in {
620- | checkThing1[String]/*(instancesString<<(10:15)>>)*/
621- | }/*(here<<(5:15)>>)*/
622- | }/*(subjectRegistrationFunction<<(3:15)>>)*/
620+ | checkThing1[String]/*(using instancesString<<(10:15)>>)*/
621+ | }/*(using here<<(5:15)>>)*/
622+ | }/*(using subjectRegistrationFunction<<(3:15)>>)*/
623623 |
624624 | def checkThing1[A](implicit ev: Eq[A])/*: Nothing<<scala/Nothing#>>*/ = ???
625625 | def checkThing2[A](implicit ev: Eq[A], sem: Semigroup[A])/*: Nothing<<scala/Nothing#>>*/ = ???
@@ -664,4 +664,104 @@ class InlayHintsSuite extends BaseInlayHintsSuite {
664664 |case class ErrorMessage(error)
665665 |""" .stripMargin
666666 )
667- }
667+
668+ @ Test def `anonymous-given` =
669+ check(
670+ """ |package example
671+ |
672+ |trait Ord[T]:
673+ | def compare(x: T, y: T): Int
674+ |
675+ |given intOrd: Ord[Int] with
676+ | def compare(x: Int, y: Int) =
677+ | if x < y then -1 else if x > y then +1 else 0
678+ |
679+ |given Ord[String] with
680+ | def compare(x: String, y: String) =
681+ | x.compare(y)
682+ |
683+ |""" .stripMargin,
684+ """ |package example
685+ |
686+ |trait Ord[T]:
687+ | def compare(x: T, y: T): Int
688+ |
689+ |given intOrd: Ord[Int] with
690+ | def compare(x: Int, y: Int)/*: Int<<scala/Int#>>*/ =
691+ | if x < y then -1 else if x > y then +1 else 0
692+ |
693+ |given Ord[String] with
694+ | def compare(x: String, y: String)/*: Int<<scala/Int#>>*/ =
695+ | /*augmentString<<scala/Predef.augmentString().>>(*/x/*)*/.compare(y)
696+ |
697+ |""" .stripMargin
698+ )
699+
700+ @ Test def `context-bounds1` =
701+ check(
702+ """ |package example
703+ |object O {
704+ | given Int = 1
705+ | def test[T: Ordering](x: T)(using Int) = ???
706+ | test(1)
707+ |}
708+ |""" .stripMargin,
709+ """ |package example
710+ |object O {
711+ | given Int = 1
712+ | def test[T: Ordering](x: T)(using Int)/*: Nothing<<scala/Nothing#>>*/ = ???
713+ | test/*[Int<<scala/Int#>>]*/(1)/*(using Int<<scala/math/Ordering.Int.>>, given_Int<<(2:8)>>)*/
714+ |}
715+ |""" .stripMargin
716+ )
717+
718+ @ Test def `context-bounds2` =
719+ check(
720+ """ |package example
721+ |object O {
722+ | def test[T: Ordering](x: T) = ???
723+ | test(1)
724+ |}
725+ |""" .stripMargin,
726+ """ |package example
727+ |object O {
728+ | def test[T: Ordering](x: T)/*: Nothing<<scala/Nothing#>>*/ = ???
729+ | test/*[Int<<scala/Int#>>]*/(1)/*(using Int<<scala/math/Ordering.Int.>>)*/
730+ |}
731+ |""" .stripMargin
732+ )
733+
734+ @ Test def `context-bounds3` =
735+ check(
736+ """ |package example
737+ |object O {
738+ | def test[T: Ordering](x: T)(using Int) = ???
739+ | test(1)
740+ |}
741+ |""" .stripMargin,
742+ """ |package example
743+ |object O {
744+ | def test[T: Ordering](x: T)(using Int)/*: Nothing<<scala/Nothing#>>*/ = ???
745+ | test/*[Int<<scala/Int#>>]*/(1)/*(using Int<<scala/math/Ordering.Int.>>)*/
746+ |}
747+ |""" .stripMargin
748+ )
749+
750+ @ Test def `context-bounds4` =
751+ check(
752+ """ |package example
753+ |object O {
754+ | implicit val i: Int = 123
755+ | def test[T: Ordering](x: T)(implicit v: Int) = ???
756+ | test(1)
757+ |}
758+ |""" .stripMargin,
759+ """ |package example
760+ |object O {
761+ | implicit val i: Int = 123
762+ | def test[T: Ordering](x: T)(implicit v: Int)/*: Nothing<<scala/Nothing#>>*/ = ???
763+ | test/*[Int<<scala/Int#>>]*/(1)/*(using Int<<scala/math/Ordering.Int.>>, i<<(2:15)>>)*/
764+ |}
765+ |""" .stripMargin
766+ )
767+ }
0 commit comments