Skip to content

Commit

Permalink
Merge pull request #594 from iusildra/skip-exported-and-boxesruntime
Browse files Browse the repository at this point in the history
Skip exported methods and BoxeRuntimes
  • Loading branch information
adpi2 authored Sep 22, 2023
2 parents 3dc1c9f + 4e13d9c commit e535f77
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ private[internal] object RuntimeStepFilter {
"scala.runtime.LazyLong",
"scala.runtime.LazyFloat",
"scala.runtime.LazyDouble",
"scala.runtime.LazyUnit"
"scala.runtime.LazyUnit",
"scala.runtime.BoxesRunTime"
)
private val scala3ClassesToSkip = scalaClassesToSkip ++ Set("scala.runtime.LazyVals$")
private val scala2ClassesToSkip = scalaClassesToSkip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,41 @@ class Scala3StepFilterTests extends StepFilterTests(ScalaVersion.`3.1+`) {
check(Breakpoint(7), StepIn.method(if (isScala3) "Main.m(message: String): Unit" else "Main$.mTarget(String)"))
}

test("skip boxing methods") {
val source =
"""|package example
|
|object Main {
| def main(args: Array[String]): Unit = {
| val f: Int => String = x => x.toString
| f(1)
| }
|}""".stripMargin
implicit val debuggee: TestingDebuggee = TestingDebuggee.mainClass(source, "example.Main", scalaVersion)
check(Breakpoint(6), StepIn.line(5))
}

test("skip exported methods") {
val source =
"""|package example
|
|case class A():
| def aa = 42
|
|case class B(a: A):
| export a.*
|
|@main def Main =
| val b = B(A())
| b.aa
|""".stripMargin
implicit val debuggee: TestingDebuggee = TestingDebuggee.mainClass(source, "example.Main", scalaVersion)
check(
Breakpoint(11),
StepIn.line(4)
)
}

test("given lazy val") {
val source =
"""|package example
Expand Down Expand Up @@ -737,8 +772,6 @@ abstract class StepFilterTests(protected val scalaVersion: ScalaVersion) extends
Breakpoint(31),
StepIn.line(17),
Breakpoint(32),
StepIn.method("BoxesRunTime.boxToInteger(int): Integer"),
StepOut.line(32),
StepIn.line(18),
Breakpoint(33),
StepIn.line(19)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,5 +414,5 @@ class Scala3Unpickler(
case BinaryMethod(_, _, Setter) => true
case BinaryMethod(_, _, MixinForwarder) => true
case BinaryMethod(_, _, TraitStaticAccessor) => true
case BinaryMethod(_, sym, _) => sym.isSynthetic
case BinaryMethod(_, sym, _) => sym.isSynthetic || sym.isExport
case _ => false

0 comments on commit e535f77

Please sign in to comment.