Commit b2f94da
Kotlin: converge delegated property accessor locations onto K2 property span
For local and member delegated properties, the synthesised accessor
(`<get-prop>`/`<set-prop>`) and its generated wrapper class/constructor
were anchored by the K1 frontend at the delegate expression rather than
at the property declaration. K2 (raw IR) anchors them at the property
`val`/`var` keyword through the end of the delegate, i.e. the whole
`KtProperty` span.
Adopt the K2 span for both frontends so the extractor emits identical
locations regardless of the supplied language version. Example:
<get-prop1> 6:24:9:9 -> 6:9:9:9
Add `getPsiBasedDelegatedAccessorLocation`, which walks from the
accessor's PSI up to the enclosing `KtProperty` and returns its span.
It returns null when there is no PSI (K2) or no enclosing property, so
K2 keeps its native locations and non-delegated callables are
unaffected. Wire it into `extractFunction`'s location chain and into
`extractGeneratedClass` (guarded on `DELEGATED_PROPERTY_ACCESSOR`) so the
generated class/constructor sorts before the method, matching K2.
Updates test-kotlin1 expected only (test-kotlin2 unchanged).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 240103e commit b2f94da
7 files changed
Lines changed: 708 additions & 661 deletions
File tree
- java
- kotlin-extractor/src/main/kotlin
- ql/test-kotlin1/library-tests
- exprs
- methods
Lines changed: 48 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2463 | 2463 | | |
2464 | 2464 | | |
2465 | 2465 | | |
| 2466 | + | |
2466 | 2467 | | |
2467 | 2468 | | |
2468 | 2469 | | |
| |||
3076 | 3077 | | |
3077 | 3078 | | |
3078 | 3079 | | |
| 3080 | + | |
| 3081 | + | |
| 3082 | + | |
| 3083 | + | |
| 3084 | + | |
| 3085 | + | |
| 3086 | + | |
| 3087 | + | |
| 3088 | + | |
| 3089 | + | |
| 3090 | + | |
| 3091 | + | |
| 3092 | + | |
| 3093 | + | |
| 3094 | + | |
| 3095 | + | |
| 3096 | + | |
| 3097 | + | |
| 3098 | + | |
| 3099 | + | |
| 3100 | + | |
| 3101 | + | |
| 3102 | + | |
| 3103 | + | |
| 3104 | + | |
| 3105 | + | |
| 3106 | + | |
| 3107 | + | |
| 3108 | + | |
| 3109 | + | |
| 3110 | + | |
| 3111 | + | |
| 3112 | + | |
| 3113 | + | |
| 3114 | + | |
| 3115 | + | |
3079 | 3116 | | |
3080 | 3117 | | |
3081 | 3118 | | |
| |||
9372 | 9409 | | |
9373 | 9410 | | |
9374 | 9411 | | |
| 9412 | + | |
| 9413 | + | |
| 9414 | + | |
| 9415 | + | |
| 9416 | + | |
| 9417 | + | |
| 9418 | + | |
| 9419 | + | |
| 9420 | + | |
| 9421 | + | |
9375 | 9422 | | |
9376 | 9423 | | |
9377 | 9424 | | |
9378 | 9425 | | |
9379 | | - | |
| 9426 | + | |
9380 | 9427 | | |
9381 | 9428 | | |
9382 | 9429 | | |
| |||
0 commit comments