mirror of
https://github.com/github/codeql.git
synced 2026-07-12 15:05:33 +02:00
The K1 frontend records an assignment's raw end offset at its left-hand side rather than past its right-hand value, so the ExprStmt wrapper synthesised around a bare assignment statement (`z = 4`) collapses onto the LHS and produces a zero-width span. K2 spans the whole assignment. Widen the ExprStmt wrapper location to end past the assigned value via a new `getExpressionStmtLocation` helper (reusing `correctedEndOffset`). This makes the wrapper match the inner `AssignExpr`, which already uses `e.startOffset .. rhsValue.endOffset`. The helper is a no-op for non-assignments and under K2, where the assignment already spans its value. Example (stmts.kt:17): before: 17:37:17:37 (collapsed onto LHS `z`) after: 17:37:17:41 (spans `z = 4`, 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 location shift (dominator.expected fully converges). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>