Description
It might be a compiler plugin issue more than an sbt plugin issue, but it seems like I can't get one without the other so I'm reporting here:
For users of https://github.com/polyvariant/better-tostring, updating scoverage to 2.x causes a warning to be emitted (with fatal warnings, that becomes an error).
For example, this Scala:
case class A(s: String, s2: String)
gets rewritten by better-tostring to something like the following:
case class A(s: String, s2: String {
override def toString: String = "A(" + "s = " + s + ", " + "s2 = " + s2 + ")"
}
and the scoverage plugin complains:
[error] Could not instrument [Apply/method +].
Notably, this worked in sbt-scoverage 1.9.3 but doesn't work in 2.0.5. I'm using Scala 2.13.8, as it happens to be a stable version where both versions of scoverage work (as well as the latest better-tostring).
I might be able to work around this by ignoring the issue on Apply/method +
, but I'm not sure what the impact would be, so wanted to report it anyway.
Reproduction
-
clone https://github.com/kubukoz/demos/tree/scoverage-change-b2s
-
in the project:
sbt
clean;coverage;compile
- the above will fail. Switch versions of sbt-scoverage in
plugins.sbt
, and it starts working again.