Skip to content

Commit

Permalink
fix: fallback to boxing case
Browse files Browse the repository at this point in the history
  • Loading branch information
iusildra committed Jun 9, 2023
1 parent 49e36f1 commit 9ad27b6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ private[internal] class EvaluationProvider(
compilePrepare(expression, frame).orElse(Success(RuntimeExpression(tree)))
case Valid(tree) => Success(RuntimeExpression(tree))
case Fatal(e) => Failure(e)
case _: Invalid => compilePrepare(expression, frame)
case inv: Invalid =>
println(s"\u001b[31mInvalid expression: ${inv.exception}\u001b[0m")
compilePrepare(expression, frame)
}
else compilePrepare(expression, frame)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private[evaluator] class RuntimeEvaluationHelpers(frame: JdiFrame) {
}
}

private def argsMatch(method: Method, args: Seq[Type], frame: JdiFrame, boxing: Boolean): Boolean =
private def argsMatch(method: Method, args: Seq[Type], boxing: Boolean): Boolean =
method.argumentTypeNames().size() == args.size && areAssignableFrom(method, args, boxing)

/**
Expand Down Expand Up @@ -90,11 +90,11 @@ private[evaluator] class RuntimeEvaluationHelpers(frame: JdiFrame) {
if (encode) NameTransformer.encode(funName) else funName
}.asScalaList

val candidatesWithoutBoxing = candidates.filter { argsMatch(_, args, frame, boxing = false) }
val candidatesWithoutBoxing = candidates.filter { argsMatch(_, args, boxing = false) }

val candidatesWithBoxing = candidatesWithoutBoxing.size match {
case 0 | 1 => candidatesWithoutBoxing
case _ => candidates.filter { argsMatch(_, args, frame, boxing = true) }
case 0 => candidates.filter { argsMatch(_, args, boxing = true) }
case _ => candidatesWithoutBoxing
}

val withoutBridges = candidatesWithBoxing.size match {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ abstract class RuntimeEvaluatorTests(val scalaVersion: ScalaVersion) extends Deb
)
}

test("Should resolve overloads in 2 steps when boxing is available".only) {
test("Should resolve overloads in 2 steps when boxing is available") {
implicit val debuggee = boxingOverloads
check(
Breakpoint(5),
Expand Down

0 comments on commit 9ad27b6

Please sign in to comment.