Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
iusildra committed Jul 11, 2023
1 parent 0df3abd commit 1936dd8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class RuntimeDefaultValidator(val frame: JdiFrame, val sourceLookUp: SourceLookU
.filter(_.`type`.name() != "scala.Function0", runtimeFatal = true)
.map(v => LocalVarTree(name, v.`type`))

// For attributes defined in superclass of class (and not case class), we need to call `visibleFields`
// We might sometimes need to access a 'private' attribute of a class
private def fieldLookup(name: String, ref: ReferenceType) =
Option(ref.fieldByName(name))
.orElse { ref.visibleFields().asScala.find(_.name().endsWith("$" + name)) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -439,26 +439,23 @@ abstract class RuntimeEvaluatorTests(val scalaVersion: ScalaVersion) extends Deb
)
}

test("Should access a field defined in super class --- scala") {
test("Should access a field defined in super class --- scala".only) {
val source =
"""|package example
|
|class A {
| val x = 42
|}
|
|class B extends A
|class A(x: Int)
|class B(x: Int) extends A(x) { def foo = x}
|
|object Main {
| def main(args: Array[String]): Unit = {
| val b = new B
| val b = new B(42)
| println("ok")
| }
|}
|""".stripMargin
implicit val debuggee = TestingDebuggee.mainClass(source, "example.Main", scalaVersion)
check(
Breakpoint(12),
Breakpoint(9),
Evaluation.success("b.x", 42)
)
}
Expand Down

0 comments on commit 1936dd8

Please sign in to comment.