Files
codeql/java/kotlin-extractor
Anders Fugmann 8db987e4ea Converge if/when branch (WhenBranch) locations onto K2 per-branch spans
The K1 frontend lowers `if`/`when` branches with their raw IR offsets
collapsed onto the whole enclosing IrWhen expression, so every branch
reports the same span (e.g. `stmts.kt:17:26:17:58`). K2 records per-branch
spans reconstructed from the branch condition start through the result end
(or just the result span for an `else` branch).

Reconstruct the per-branch span from the branch's own condition/result
offsets, gated on the raw branch span being collapsed onto the enclosing
IrWhen (as under K1); under K2 the raw per-branch offsets already differ so
the helper is a no-op. `correctedEndOffset` additionally fixes K1 recording
a bare assignment's raw end at its left-hand side rather than past its
right-hand value.

Example (stmts.kt:17):
  before: 17:26:17:58 (x2, both branches collapsed onto the IrWhen)
  after:  17:29:17:43 and 17:50:17:58 (per-branch, matching K2)

Only the K1 (test-kotlin1) expected files change; the K2 (test-kotlin2)
expected files are unchanged. Controlflow expected files converge as a pure
cascade of the branch-location shift.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-11 15:07:43 +02:00
..
2022-05-10 18:45:56 +01:00
2025-05-13 14:42:05 +01:00
2022-05-10 18:45:51 +01:00