Files
codeql/java/ql/test-kotlin1/library-tests/lateinit/test.expected
Anders Fugmann e37d89b849 Kotlin: converge default property-accessor locations onto the K2-native spans
Synthesised and bare `get`/`set` accessors were extracted with different
source locations depending on the frontend:

    val typedProp: Int = 3            // getTypedProp
        K1: 5:5:5:17  (val..name)     K2: 5:5:5:22  (val..type)

    val defaultGetter = 7
        get                           // getDefaultGetter
        K1: 19:5:19:21 (property head) K2: 20:13:20:15 (`get` keyword)

Under K2 the extractor has no PSI back-mapping for these accessors
(`getKtFile` returns null), so it cannot reproduce K1's property-name-end
span; K2 instead falls back to the raw IR offsets. Rather than converge on a
value K2 cannot produce, K1 is made to match the K2-native spans via the PSI:

  * a bare `get`/`set` keyword now points at the keyword token; and
  * a fully synthesised accessor now spans the property signature
    (`val`/`var` .. type annotation, or .. name when untyped), excluding the
    initialiser.

Explicit-body accessors (`get() = 5`) are unaffected: they are located at
their body and never take this override.

Only K1 output changes; the test-kotlin2 (K2) expected files are unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-11 01:46:59 +02:00

9 lines
626 B
Plaintext

| test.kt:4:15:4:26 | println(...) | file://<external>/ConsoleKt.class:0:0:0:0 | println |
| test.kt:9:9:9:13 | getTest0$private(...) | test.kt:2:22:2:40 | getTest0$private |
| test.kt:9:9:9:17 | f(...) | test.kt:4:5:4:26 | f |
| test.kt:10:13:10:23 | get(...) | test.kt:10:13:10:23 | get |
| test.kt:10:13:10:23 | getTest0$private(...) | test.kt:2:22:2:40 | getTest0$private |
| test.kt:10:13:10:23 | setTest0$private(...) | test.kt:2:22:2:40 | setTest0$private |
| test.kt:10:13:10:37 | isInitialized(...) | file://<external>/LateinitKt.class:0:0:0:0 | isInitialized |
| test.kt:14:9:14:17 | f(...) | test.kt:4:5:4:26 | f |