Skip to content

Code coverage crashes at runtime #15078

Closed
@MasseGuillaume

Description

@MasseGuillaume

I was testing the new coverage support for scala3 with:

The latest version of sbt-scoverage
https://github.com/scoverage/sbt-scoverage/tree/V2

with https://github.com/scoverage/sbt-scoverage/blob/V2/src/main/scala/scoverage/ScoverageSbtPlugin.scala#L162 set to 3.2.0-RC1-bin-SNAPSHOT

This call crashes with the instrumented code:

https://github.com/MasseGuillaume/porc-epic/blob/main/src/test/scala/porcEpic/unit/VisualizationTest.scala#L53

https://github.com/MasseGuillaume/porc-epic/blob/07157829817afd03d286f056f3c0dda3fd5e6eca/src/main/scala/porcEpic/Visualization.scala#L59-L80

Compiler version

latest (main branch)

Minimized code

import java.nio.file._
import java.io.File

extension (v: Int) {
  def save(): File = {
    Files.createTempDirectory("porc-epic").toFile
  }
}

1.save()

Output (click arrow to expand)

java.lang.ClassCastException: class scala.collection.immutable.ArraySeq$ofRef cannot be cast to class [Ljava.nio.file.attribute.FileAttribute; (scala.collection.immutable.ArraySeq$ofRef is in unnamed module of loader sbt.internal.ScalaLibraryClassLoader @53bcaacb; [Ljava.nio.file.attribute.FileAttribute; is in module java.base of loader 'bootstrap') at porcEpic.Visualization$package$.save(Visualization.scala:61) at porcEpic.unit.VisualizationTest.$init$$$anonfun$2(VisualizationTest.scala:91)

Metadata

Metadata

Labels

area:coverageCode coverage, see https://dotty.epfl.ch/docs/internals/coverage.htmlitype:bugitype:crash

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions