SIGN IN SIGN UP

Scoverage: refrain from lifting closures for capture calculus compatibility (#26067)

Fixes #26066

## Problem
Code shape at fault:

```scala
IntTreeStepper.from[T](size, tree, _.left)
```

Instrumentation transforms `_.left` into a shape that fails capture
checking:

```scala
val left$1: T => T | Null =
  {
    def $anonfun_left(x: T): T | Null = x.left
    closure($anonfun_left)
  }

IntTreeStepper.from[T](maxLength$1, tree, left$1, ..., ...)
```

For some types, like in the issue, `x.left` in the closure leads to a
capability escape which produces the corresponding error.

## Solution

Exclude closure blocks from coverage argument lifting. The tradeoff is
that we will get the instrumentation data for the callsite entry before
the closure is evaluated but capture checking will not break on the
lifted closure.

## How much have you relied on LLM-based tools in this contribution?

Moderately, for codebase analysis and tracing.

## How was the solution tested?

New automated tests (including the issue's reproducer, if applicable).
Added `tests/pos-custom-args/captures/coverage-binarytree-stepper.scala`
which fails on `main` and succeeds on this branch.
A
Anatolii Kmetiuk committed
d3c96ebb0eb17fcf79d5d36c173ee96e97995b65
Parent: 69b774f
Committed by GitHub <noreply@github.com> on 5/18/2026, 1:51:46 PM