@@ -80,6 +80,28 @@ class LambdaBreakpointsTest_2_12 extends LambdaBreakpointsTestBase {
80
80
(4 , " $anonfun$doubleIt$extension$1" )
81
81
)
82
82
}
83
+
84
+ override def testLambdaBreakpointsInsideTrait (): Unit = {
85
+ breakpointsTest()(
86
+ (22 , " $anonfun$fooFromTrait$1" ), (23 , " $anonfun$fooFromTrait$1" ), (22 , " $anonfun$fooFromTrait$1" ), (23 , " $anonfun$fooFromTrait$1" ), (25 , " fooFromTrait" ),
87
+ (33 , " $anonfun$fooFromAbstractClass$1" ), (34 , " $anonfun$fooFromAbstractClass$1" ), (33 , " $anonfun$fooFromAbstractClass$1" ), (34 , " $anonfun$fooFromAbstractClass$1" ), (36 , " fooFromAbstractClass" ),
88
+ (11 , " $anonfun$fooFromMain$1" ), (12 , " $anonfun$fooFromMain$1" ), (11 , " $anonfun$fooFromMain$1" ), (12 , " $anonfun$fooFromMain$1" ), (14 , " fooFromMain" ),
89
+ )
90
+ }
91
+
92
+ override def testOneLineLambdaInTrait (): Unit = {
93
+ breakpointsTest()(
94
+ (4 , " $anonfun$fooInTrait$1" ), (4 , " $anonfun$fooInTrait$1" ), (5 , " fooInTrait" )
95
+ )
96
+ }
97
+
98
+ override def testLineInLambdaWithLambdaOnLineInTrait (): Unit = {
99
+ breakpointsTest()(
100
+ (5 , " $anonfun$fooInTrait$1" ), (6 , " $anonfun$fooInTrait$1" ), (6 , " $anonfun$fooInTrait$2" ),
101
+ (5 , " $anonfun$fooInTrait$1" ), (6 , " $anonfun$fooInTrait$1" ), (6 , " $anonfun$fooInTrait$2" ),
102
+ (8 , " fooInTrait" )
103
+ )
104
+ }
83
105
}
84
106
85
107
class LambdaBreakpointsTest_2_13 extends LambdaBreakpointsTest_2_12 {
@@ -242,6 +264,28 @@ class LambdaBreakpointsTest_3_3 extends LambdaBreakpointsTestBase {
242
264
(4 , " ByNameInExtensionMethod$IntOpt$$$_$doubleIt$extension$$anonfun$1" )
243
265
)
244
266
}
267
+
268
+ override def testLambdaBreakpointsInsideTrait (): Unit = {
269
+ breakpointsTest()(
270
+ (22 , " $anonfun$2" ), (23 , " $anonfun$2" ), (22 , " $anonfun$2" ), (23 , " $anonfun$2" ), (25 , " fooFromTrait" ),
271
+ (33 , " $anonfun$3" ), (34 , " $anonfun$3" ), (33 , " $anonfun$3" ), (34 , " $anonfun$3" ), (36 , " fooFromAbstractClass" ),
272
+ (11 , " $anonfun$1" ), (12 , " $anonfun$1" ), (11 , " $anonfun$1" ), (12 , " $anonfun$1" ), (14 , " fooFromMain" ),
273
+ )
274
+ }
275
+
276
+ override def testOneLineLambdaInTrait (): Unit = {
277
+ breakpointsTest()(
278
+ (4 , " $anonfun$1" ), (4 , " $anonfun$1" ), (5 , " fooInTrait" )
279
+ )
280
+ }
281
+
282
+ override def testLineInLambdaWithLambdaOnLineInTrait (): Unit = {
283
+ breakpointsTest()(
284
+ (5 , " $anonfun$1" ), (6 , " $anonfun$1" ), (6 , " $anonfun$1$$anonfun$1" ),
285
+ (5 , " $anonfun$1" ), (6 , " $anonfun$1" ), (6 , " $anonfun$1$$anonfun$1" ),
286
+ (8 , " fooInTrait" )
287
+ )
288
+ }
245
289
}
246
290
247
291
class LambdaBreakpointsTest_3_4 extends LambdaBreakpointsTest_3_3 {
@@ -312,6 +356,34 @@ class LambdaBreakpointsTest_3_4 extends LambdaBreakpointsTest_3_3 {
312
356
(20 , " main" ), (20 , " main$$anonfun$9" )
313
357
)
314
358
}
359
+
360
+ override def testLambdaBreakpointsInsideTrait (): Unit = {
361
+ breakpointsTest()(
362
+ (23 , " fooFromTrait" ),
363
+ (22 , " $anonfun$2" ), (23 , " $anonfun$2" ), (22 , " $anonfun$2" ), (23 , " $anonfun$2" ), (25 , " fooFromTrait" ),
364
+ (34 , " fooFromAbstractClass" ),
365
+ (33 , " $anonfun$3" ), (34 , " $anonfun$3" ), (33 , " $anonfun$3" ), (34 , " $anonfun$3" ), (36 , " fooFromAbstractClass" ),
366
+ (12 , " fooFromMain" ),
367
+ (11 , " $anonfun$1" ), (12 , " $anonfun$1" ), (11 , " $anonfun$1" ), (12 , " $anonfun$1" ), (14 , " fooFromMain" ),
368
+ )
369
+ }
370
+
371
+ override def testLineInLambdaWithLambdaOnLineInTrait (): Unit = {
372
+ breakpointsTest()(
373
+ (6 , " fooInTrait" ),
374
+ (5 , " $anonfun$1" ), (6 , " $anonfun$1" ), (6 , " $anonfun$1$$anonfun$1" ),
375
+ (5 , " $anonfun$1" ), (6 , " $anonfun$1" ), (6 , " $anonfun$1$$anonfun$1" ),
376
+ (8 , " fooInTrait" )
377
+ )
378
+ }
379
+ }
380
+
381
+ class LambdaBreakpointsTest_3_5 extends LambdaBreakpointsTest_3_3 {
382
+ override protected def supportedIn (version : ScalaVersion ): Boolean = version == ScalaVersion .Latest .Scala_3_5
383
+ }
384
+
385
+ class LambdaBreakpointsTest_3_6 extends LambdaBreakpointsTest_3_3 {
386
+ override protected def supportedIn (version : ScalaVersion ): Boolean = version == ScalaVersion .Latest .Scala_3_6
315
387
}
316
388
317
389
class LambdaBreakpointsTest_3_RC extends LambdaBreakpointsTest_3_3 {
@@ -618,5 +690,106 @@ abstract class LambdaBreakpointsTestBase extends ScalaDebuggerTestCase {
618
690
(4 , " apply$mcI$sp" )
619
691
)
620
692
}
693
+
694
+ addSourceFile(" LambdaBreakpointsInsideTrait.scala" ,
695
+ s """
696
+ |object LambdaBreakpointsInsideTrait extends MyAbstractClass with MyTrait {
697
+ | def main(args: Array[String]): Unit = {
698
+ | fooFromTrait()
699
+ | fooFromAbstractClass()
700
+ | fooFromMain()
701
+ | }
702
+ |
703
+ | def fooFromMain(): Unit = {
704
+ | val seq = 1 to 2
705
+ | val seqNew = seq.map { item =>
706
+ | val x = 1 + 1 $breakpoint
707
+ | item + x $breakpoint
708
+ | }
709
+ | println(seqNew) $breakpoint
710
+ | }
711
+ |}
712
+ |
713
+ |trait MyTrait {
714
+ | def fooFromTrait(): Unit = {
715
+ | val seq = 1 to 2
716
+ | val seqNew = seq.map { item =>
717
+ | val x = 1 + 1 $breakpoint
718
+ | item + x $breakpoint
719
+ | }
720
+ | println(seqNew) $breakpoint
721
+ | }
722
+ |}
723
+ |
724
+ |abstract class MyAbstractClass {
725
+ | def fooFromAbstractClass(): Unit = {
726
+ | val seq = 1 to 2
727
+ | val seqNew = seq.map { item =>
728
+ | val x = 1 + 1 $breakpoint
729
+ | item + x $breakpoint
730
+ | }
731
+ | println(seqNew) $breakpoint
732
+ | }
733
+ |}
734
+ | """ .stripMargin)
735
+
736
+ def testLambdaBreakpointsInsideTrait (): Unit = {
737
+ breakpointsTest()(
738
+ (22 , " apply$mcII$sp" ), (23 , " apply$mcII$sp" ), (22 , " apply$mcII$sp" ), (23 , " apply$mcII$sp" ), (25 , " fooFromTrait" ),
739
+ (33 , " apply$mcII$sp" ), (34 , " apply$mcII$sp" ), (33 , " apply$mcII$sp" ), (34 , " apply$mcII$sp" ), (36 , " fooFromAbstractClass" ),
740
+ (11 , " apply$mcII$sp" ), (12 , " apply$mcII$sp" ), (11 , " apply$mcII$sp" ), (12 , " apply$mcII$sp" ), (14 , " fooFromMain" ),
741
+ )
742
+ }
743
+
744
+ addSourceFile(" OneLineLambdaInTrait.scala" ,
745
+ s """
746
+ |trait MyTraitWithOneLineLambda {
747
+ | def fooInTrait(): Unit = {
748
+ | val seq = 1 to 2
749
+ | val seqNew = seq.map(_ + 2) $breakpoint ${lambdaOrdinal(0 )}
750
+ | println(seqNew) $breakpoint
751
+ | }
752
+ |}
753
+ |
754
+ |object OneLineLambdaInTrait extends MyTraitWithOneLineLambda {
755
+ | def main(args: Array[String]): Unit = {
756
+ | fooInTrait()
757
+ | }
758
+ |}
759
+ | """ .stripMargin)
760
+
761
+ def testOneLineLambdaInTrait (): Unit = {
762
+ breakpointsTest()(
763
+ (4 , " apply$mcII$sp" ), (4 , " apply$mcII$sp" ), (5 , " fooInTrait" )
764
+ )
765
+ }
766
+
767
+ addSourceFile(" LineInLambdaWithLambdaOnLineInTrait.scala" ,
768
+ s """
769
+ |trait MyTraitWithLambdaWithLambdaOnLine {
770
+ | def fooInTrait(): Unit = {
771
+ | val seq = 1 to 2
772
+ | val seqNew = seq.flatMap { item =>
773
+ | val x = 1 + 1 $breakpoint
774
+ | Seq(item).map(_ + x) $breakpoint
775
+ | }
776
+ | println(seqNew) $breakpoint
777
+ | }
778
+ |}
779
+ |
780
+ |object LineInLambdaWithLambdaOnLineInTrait extends MyTraitWithLambdaWithLambdaOnLine {
781
+ | def main(args: Array[String]): Unit = {
782
+ | fooInTrait()
783
+ | }
784
+ |}
785
+ | """ .stripMargin)
786
+
787
+ def testLineInLambdaWithLambdaOnLineInTrait (): Unit = {
788
+ breakpointsTest()(
789
+ (5 , " apply" ), (6 , " apply" ), (6 , " apply$mcII$sp" ),
790
+ (5 , " apply" ), (6 , " apply" ), (6 , " apply$mcII$sp" ),
791
+ (8 , " fooInTrait" )
792
+ )
793
+ }
621
794
}
622
795
0 commit comments