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

coverageReport task fails when using Scala 3.2.0 with -Yexplicit-nulls #470

Open
klaeufer opened this issue Oct 18, 2022 · 2 comments
Open

Comments

@klaeufer
Copy link

sbt-scoverage seems to be incompatible with Scala 3's explicit nulls language feature.

I first made some minimal changes to convert sbt-scoverage-samples to explicit nulls:

https://github.com/scoverage/sbt-scoverage-samples/compare/main...klaeufer:sbt-scoverage-samples:scala3-explicit-nulls?expand=1

When running sbt clean coverage test coverageReport, all tests still pass, but the subsequent coverageReport task fails. The cause seems to be the stdLibPatches made to Predef.scala to enable the explicit nulls feature.

[info] Waiting for measurement data to sync...
[info] Reading scoverage instrumentation [/Users/laufer/Dropbox/Home/Work/teaching/cs371/sbt-scoverage-samples/target/scala-3.2.0/scoverage-data/scoverage.coverage]
[info] Reading scoverage measurements...
[info] Generating scoverage reports...
[info] Written Cobertura report [/Users/laufer/Dropbox/Home/Work/teaching/cs371/sbt-scoverage-samples/target/scala-3.2.0/coverage-report/cobertura.xml]
[info] Written XML coverage report [/Users/laufer/Dropbox/Home/Work/teaching/cs371/sbt-scoverage-samples/target/scala-3.2.0/scoverage-report/scoverage.xml]
[error] java.lang.RuntimeException: No source root found for '/Users/laufer/Dropbox/Home/Work/teaching/cs371/sbt-scoverage-samples/library/src/scala/runtime/stdLibPatches/Predef.scala' (source roots: '/Users/laufer/Dropbox/Home/Work/teaching/cs371/sbt-scoverage-samples/src/main/scala/')
...
@ckipp01
Copy link
Member

ckipp01 commented Oct 20, 2022

Thanks for the report @klaeufer although I'm a bit surprised by the issue. The coverer samples has some odd stuff going on, so it actually might be better to provide a hello world project with a very minimal reproduction just to confirm this happens on a fresh project using 3.2.x and these settings. Locally trying it out on a hello world project I didn't have that issue.

@klaeufer
Copy link
Author

@ckipp01 Thanks and sorry it took me this long to respond. Here is the hello world project: https://github.com/klaeufer/hello-explicitnulls-scala I confirmed in GitPod that the same issue occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants