Skip to content

Scoverage: Path-dependent types lose their coverage identity during lifting #26781

Description

@anatoliykmetyuk

Compiler version

3.10.0-RC1-bin-SNAPSHOT - on latest main as of 6 August 2026, commit 266b5b3afe.

Minimized code

import language.experimental.captureChecking

class Repro { self: Repro^ =>
  def coll: this.type = this

  def withFilter(p: Any^): WithFilter^{this, p} =
    new WithFilter(coll, p)
}

class WithFilter(val source: Repro^, val predicate: Any^)

Command

sbt -error -no-colors "scala3-bootstrapped/scalac -color:never -language:experimental.captureChecking -coverage-out target/issue-coverage -sourceroot . -d target/issue-out Repro.scala"

Output

-- [E007] Type Mismatch Error: Repro.scala:7:4 -------------------------------
7 |    new WithFilter(coll, p)
  |    ^^^^^^^^^^^^^^^^^^^^^^^
  |  Found:    WithFilter{
  |    val source: (Repro.this.coll : -> (Repro.this : Repro^{any}));
  |      val predicate: (p : Any^)
  |  }^{any, p}
  |  Required: WithFilter^{Repro.this, p}
  |
  |  Note that capability `any` cannot flow into capture set {Repro.this, p}.
1 error found
[error] nonzero exit code returned from runner: 1
[error] (scala3-compiler-bootstrapped / Compile / runMain) nonzero exit code returned from runner: 1

Expectation

Compilation succeeds with coverage instrumentation.

Notes

Is a blocker for scoverage to work with stdlib.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:coverageCode coverage, see https://dotty.epfl.ch/docs/internals/coverage.htmlarea:experimental:ccCapture checking relateditype:bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions