Skip to content

Compilation with the plugin produces warning after updating to 2.x #476

Open
@kubukoz

Description

@kubukoz

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

  1. clone https://github.com/kubukoz/demos/tree/scoverage-change-b2s

  2. in the project:

sbt
clean;coverage;compile
  1. the above will fail. Switch versions of sbt-scoverage in plugins.sbt, and it starts working again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions