From e484975de8aff8f65a87e6e469f116621d1c459a Mon Sep 17 00:00:00 2001 From: Lucas Nouguier Date: Fri, 21 Jul 2023 13:46:05 +0200 Subject: [PATCH] allow step into in classes with special names --- .../internal/stacktrace/Scala2Unpickler.scala | 2 +- modules/java-debug | 2 +- .../scala/debugadapter/StepFilterTests.scala | 25 +++++++++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/modules/core/src/main/scala/ch/epfl/scala/debugadapter/internal/stacktrace/Scala2Unpickler.scala b/modules/core/src/main/scala/ch/epfl/scala/debugadapter/internal/stacktrace/Scala2Unpickler.scala index 09e34610d..b34529452 100644 --- a/modules/core/src/main/scala/ch/epfl/scala/debugadapter/internal/stacktrace/Scala2Unpickler.scala +++ b/modules/core/src/main/scala/ch/epfl/scala/debugadapter/internal/stacktrace/Scala2Unpickler.scala @@ -124,7 +124,7 @@ class Scala2Unpickler( .foldRight(Option(javaClass.name)) { (sym, acc) => for (javaName <- acc if javaName.contains(sym.name)) yield javaName - .split(sym.name) + .split(sym.name.replaceAll("\\$", "\\\\\\$")) .drop(1) .mkString(sym.name) } diff --git a/modules/java-debug b/modules/java-debug index 6204e0a72..23df7eb04 160000 --- a/modules/java-debug +++ b/modules/java-debug @@ -1 +1 @@ -Subproject commit 6204e0a72c316368eb5a27fe9b040a9288808190 +Subproject commit 23df7eb041adbcfbde6a4b4f9118605c1bae9d16 diff --git a/modules/tests/src/test/scala/ch/epfl/scala/debugadapter/StepFilterTests.scala b/modules/tests/src/test/scala/ch/epfl/scala/debugadapter/StepFilterTests.scala index cf21606d5..e6b26e600 100644 --- a/modules/tests/src/test/scala/ch/epfl/scala/debugadapter/StepFilterTests.scala +++ b/modules/tests/src/test/scala/ch/epfl/scala/debugadapter/StepFilterTests.scala @@ -49,6 +49,31 @@ class Scala213StepFilterTests extends StepFilterTests(ScalaVersion.`2.13`) { implicit val debuggee: TestingDebuggee = TestingDebuggee.mainClass(source, "example.Main", ScalaVersion.`2.13`) check(Breakpoint(14), StepIn.line(9), Breakpoint(16), StepIn.line(10)) } + + test("should step into method of local class") { + val source = + """|package example + | + |class `A+B` { + | val foo = 42 + | object && { + | def x = { + | println(foo) + | 42 + | } + | } + |} + | + |object Main { + | def main(args: Array[String]): Unit = { + | val ab = new `A+B` + | println(ab.&&.x) + | } + |} + |""".stripMargin + implicit val debuggee: TestingDebuggee = TestingDebuggee.mainClass(source, "example.Main", ScalaVersion.`2.13`) + check(Breakpoint(8), Evaluation.success("foo", 42)) + } } abstract class StepFilterTests(protected val scalaVersion: ScalaVersion) extends DebugTestSuite {