Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-coverage-out generates wrong source paths on java 1.8 runtime #15233

Closed
pikinier20 opened this issue May 19, 2022 · 0 comments · Fixed by #15240
Closed

-coverage-out generates wrong source paths on java 1.8 runtime #15233

pikinier20 opened this issue May 19, 2022 · 0 comments · Fixed by #15240
Labels
area:coverage Code coverage, see https://dotty.epfl.ch/docs/internals/coverage.html itype:bug

Comments

@pikinier20
Copy link
Contributor

pikinier20 commented May 19, 2022

Compiler version

3.2.0-RC1-bin-20220517-e5abec0-NIGHTLY

8bae490

Minimized code

Let's create a file GoodCoverage.scala:

object GoodCoverage {

  def sum(num1: Int, num2: Int) = {
    if (0 == num1) num2 else if (0 == num2) num1 else num1 + num2
  }

}

then let's try to compile it using java 1.8 runtime (I've used jenv for that) and set the coverage flag:

 ~/dotty/dist/target/pack/bin/scalac -coverage-out:scoverage.coverage GoodCoverage.scala

Output

The generated coverage file contains wrong paths to sources:

../GoodCoverage.scala

The .. part is wrong because this file is present in the cwd.

Expectation

The path should be the same as when using java 11+ runtime:

GoodCoverage.scala

This issue is blocking addition of support for Scala 3 in sbt-scoverage: scoverage/sbt-scoverage#429

@pikinier20 pikinier20 added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels May 19, 2022
@nicolasstucki nicolasstucki added area:coverage Code coverage, see https://dotty.epfl.ch/docs/internals/coverage.html and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels May 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:coverage Code coverage, see https://dotty.epfl.ch/docs/internals/coverage.html itype:bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants