@@ -19,7 +19,7 @@ class InlayHintsSuite extends BaseInlayHintsSuite {
19
19
| def foo()/*: Unit<<scala/Unit#>>*/ = {
20
20
| implicit val imp: Int = 2
21
21
| 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)>>)*/
23
23
| }
24
24
|}
25
25
|""" .stripMargin
@@ -66,7 +66,7 @@ class InlayHintsSuite extends BaseInlayHintsSuite {
66
66
|object Main {
67
67
| implicit val imp: Int = 2
68
68
| 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)>>)*/
70
70
|}
71
71
|""" .stripMargin
72
72
)
@@ -100,7 +100,7 @@ class InlayHintsSuite extends BaseInlayHintsSuite {
100
100
|object Main {
101
101
| implicit val imp: Int = 2
102
102
| 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)>>)*/
104
104
|}
105
105
|""" .stripMargin
106
106
)
@@ -502,7 +502,7 @@ class InlayHintsSuite extends BaseInlayHintsSuite {
502
502
|}
503
503
|""" .stripMargin,
504
504
""" |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.>>)*/
506
506
|}
507
507
|""" .stripMargin
508
508
)
@@ -608,18 +608,18 @@ class InlayHintsSuite extends BaseInlayHintsSuite {
608
608
|
609
609
| /*StringTestOps<<(6:17)>>(*/"foo"/*)*/ should {
610
610
| /*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)>>)*/
613
613
| /*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)>>)*/
617
617
|
618
618
| /*StringTestOps<<(6:17)>>(*/"bar"/*)*/ should {
619
619
| /*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)>>)*/
623
623
|
624
624
| def checkThing1[A](implicit ev: Eq[A])/*: Nothing<<scala/Nothing#>>*/ = ???
625
625
| def checkThing2[A](implicit ev: Eq[A], sem: Semigroup[A])/*: Nothing<<scala/Nothing#>>*/ = ???
@@ -664,4 +664,104 @@ class InlayHintsSuite extends BaseInlayHintsSuite {
664
664
|case class ErrorMessage(error)
665
665
|""" .stripMargin
666
666
)
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