Files
codeql/java/kotlin-extractor
Anders Fugmann 5146b010d7 Kotlin: narrow plain-assignment LHS VarAccess to the target identifier under K2
For a plain assignment `x = v`, the K2/FIR frontend records the set
operation's end offset past the assigned value, so the left-hand-side
`VarAccess` was located over the whole `x = v` rather than just the target
identifier `x`. K1's set-value end offset already stops at the identifier,
so the two frontends diverged (and this cascaded into the controlflow
tests). A `VarAccess` should be located at the variable reference, not the
whole assignment, so K1's identifier-only span is canonical.

`getPlainSetValueLhsIdentifierLocation` narrows the LHS location to the
target identifier for a plain `IrSetValue`, deriving the identifier end as
`startOffset + name.length`. This is applied only when the target name is
an unquoted simple identifier (not special, not a hard keyword, no
backtick-requiring characters), so backtick-quoted names, keyword names and
qualified receivers all fall back to the raw location. Gated on K2, since
under K1 the raw location is already identifier-only.

Relearned both suites (3333 tests each); only K2 expected files change, all
narrowing LHS `VarAccess` locations to match K1.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 86bfc022-3ecc-4746-ba23-3b76c4e4c3e4
2026-07-15 01:12:40 +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