scalacenter / scala-debug-adapter

Implementation of the Debug Adapter Protocol for Scala

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot pause inside inner class `&&` of class `A+B` in Scala 2

adpi2 opened this issue · comments

commented

I have absolutely no idea of why in Scala 2 there are no breakpoints inside A+B$$amp$amp$#x in file RuntimeEvaluatorTests.scala:898
I launched the same program in a debug session and placed breakpoints on the whole method. Never reached them

Originally posted by @iusildra in #484 (comment)

I think I found the problem.
In Scala2Unpickler#skipScala:43 there is a matchingMethods.forAll(skip). If matchingMethods is empty (it did not find a proper method), it will return true. The quick fix would be to add a check matchingMethods.isEmpty

When digging a bit the problem seems to be with Scala2Unpickler#matchSymbol

  • matchName & matchSignature work as expected
  • matchOwner fails because String.split takes a regex and the class name is A$plusB, which is not a valid regex. So the problem appear to be with classes whose names contain special characters

I'll add the fix for the matchOwner but what should we do about the matchingMethods.isEmpty ?

commented

what should we do about the matchingMethods.isEmpty ?

It skips the method on purpose because it assumes the method is a mixin-forwarder. An improvement which is on the todo list of @aymanelamyaghri is to find the mixin -forwarder in the trait to validate that it is indeed a mixin-forwader. Then we will be able to do what you suggest: skip should return false is the matchingMethods is empty.

I'll add the fix for the matchOwner

Nice, that should fix this issue.