Skip to content

fix(coverage): a line with two ERROR nodes reports the same range twice #1965

Description

@CaptainMittens

scripts/setup-windows.ps1 has 326 lines. Its parse-coverage report reads:

113-113,113-113,245-327

Line 113 is named twice. Found while building the CI coverage gate in #1941; not fixed there.

What happens

Line 113 carries two separate ERROR nodes, at columns 25-29 and 31-32. cbm_error_regions_push pushes a range for each one. A line range is advice — "read these lines" — and saying it a second time adds nothing.

Why it matters beyond the noise

Both copies count against CBM_MAX_ERROR_REGIONS. A file with many multi-error lines can therefore be clipped, and report ,+<N>, while carrying fewer distinct lines than the cap allows.

Suggested fix

Merge a region that overlaps the range already open instead of appending a repeat. The walk visits children in source order, so a region that starts at or before the open range's end really does overlap it. The merge has to run before the cap check, or a merged region is miscounted as a dropped one.

Related: #963, #1941. Sibling finding: the past-EOF end line in the same range string.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    windowsWindows-specific issues

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions