Commit dc81b51
Kotlin: converge synthetic value-parameter locations onto their owning declaration
Two compiler-synthesised value parameters that carry no source token of their
own were located differently by the K1 and K2 frontends:
- the `<set-?>` parameter of a delegated property's synthesised setter: K1
anchored it at the delegate expression (`delegates.kt:8:32:11:5`) while K2
spans the whole property declaration (`8:5:11:5`); and
- the `value` parameter of the synthetic enum `valueOf` member: K1 has no
offsets and emitted the null `0:0:0:0` location while K2 attributes it to
the enum-class declaration (`1:1:4:1`).
In both cases the parameter is synthesised, so the K2 span (the owning
declaration) is a real, navigable location and strictly more useful than either
the delegate-expression fragment or K1's null `0:0`. We therefore converge K1
onto the K2-native span, consistent with how the other synthesised members
(accessors, implicit constructors, super calls, `$delegate` fields) are already
being anchored on their owning declaration.
`getPsiBasedSyntheticParameterLocation` recovers the span from the PSI under K1
and returns null under K2 (where `getKtFile` is unavailable and the raw offsets
already carry the owning-declaration span) and for every ordinary, source-backed
parameter, so the canonical K2 output is untouched.
Relearn (both suites, CPUS=5): all 3333 tests pass. Only test-kotlin1 changes;
methods/parameters is now byte-identical across suites (6 -> 0 divergent rows),
and the same setter/valueOf parameter rows converge in the PrintAst/exprs
projections that reference them (annotation_classes/PrintAst 88->84,
classes/PrintAst 18->10, exprs/PrintAst 75->67, exprs/exprs 189->171,
exprs_typeaccess/PrintAst 9->5, methods/exprs 36->30). Every touched file's
divergence strictly decreases; no new divergence is introduced.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 7b1da21 commit dc81b51
8 files changed
Lines changed: 77 additions & 27 deletions
File tree
- java
- kotlin-extractor/src/main/kotlin
- ql/test-kotlin1/library-tests
- annotation_classes
- classes
- exprs_typeaccess
- exprs
- methods
Lines changed: 50 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1383 | 1383 | | |
1384 | 1384 | | |
1385 | 1385 | | |
| 1386 | + | |
1386 | 1387 | | |
1387 | 1388 | | |
1388 | 1389 | | |
| |||
3166 | 3167 | | |
3167 | 3168 | | |
3168 | 3169 | | |
| 3170 | + | |
| 3171 | + | |
| 3172 | + | |
| 3173 | + | |
| 3174 | + | |
| 3175 | + | |
| 3176 | + | |
| 3177 | + | |
| 3178 | + | |
| 3179 | + | |
| 3180 | + | |
| 3181 | + | |
| 3182 | + | |
| 3183 | + | |
| 3184 | + | |
| 3185 | + | |
| 3186 | + | |
| 3187 | + | |
| 3188 | + | |
| 3189 | + | |
| 3190 | + | |
| 3191 | + | |
| 3192 | + | |
| 3193 | + | |
| 3194 | + | |
| 3195 | + | |
| 3196 | + | |
| 3197 | + | |
| 3198 | + | |
| 3199 | + | |
| 3200 | + | |
| 3201 | + | |
| 3202 | + | |
| 3203 | + | |
| 3204 | + | |
| 3205 | + | |
| 3206 | + | |
| 3207 | + | |
| 3208 | + | |
| 3209 | + | |
| 3210 | + | |
| 3211 | + | |
| 3212 | + | |
| 3213 | + | |
| 3214 | + | |
| 3215 | + | |
| 3216 | + | |
| 3217 | + | |
| 3218 | + | |
3169 | 3219 | | |
3170 | 3220 | | |
3171 | 3221 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
178 | | - | |
179 | | - | |
| 178 | + | |
| 179 | + | |
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
169 | | - | |
170 | | - | |
| 169 | + | |
| 170 | + | |
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
206 | | - | |
207 | | - | |
| 206 | + | |
| 207 | + | |
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3350 | 3350 | | |
3351 | 3351 | | |
3352 | 3352 | | |
3353 | | - | |
3354 | | - | |
| 3353 | + | |
| 3354 | + | |
3355 | 3355 | | |
3356 | 3356 | | |
3357 | 3357 | | |
| |||
3387 | 3387 | | |
3388 | 3388 | | |
3389 | 3389 | | |
3390 | | - | |
3391 | | - | |
| 3390 | + | |
| 3391 | + | |
3392 | 3392 | | |
3393 | 3393 | | |
3394 | 3394 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
229 | | - | |
| 229 | + | |
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
| |||
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
339 | | - | |
| 339 | + | |
340 | 340 | | |
341 | 341 | | |
342 | 342 | | |
| |||
399 | 399 | | |
400 | 400 | | |
401 | 401 | | |
402 | | - | |
| 402 | + | |
403 | 403 | | |
404 | 404 | | |
405 | 405 | | |
| |||
458 | 458 | | |
459 | 459 | | |
460 | 460 | | |
461 | | - | |
| 461 | + | |
462 | 462 | | |
463 | 463 | | |
464 | 464 | | |
| |||
523 | 523 | | |
524 | 524 | | |
525 | 525 | | |
526 | | - | |
| 526 | + | |
527 | 527 | | |
528 | 528 | | |
529 | 529 | | |
| |||
686 | 686 | | |
687 | 687 | | |
688 | 688 | | |
689 | | - | |
| 689 | + | |
690 | 690 | | |
691 | 691 | | |
692 | 692 | | |
| |||
826 | 826 | | |
827 | 827 | | |
828 | 828 | | |
829 | | - | |
| 829 | + | |
830 | 830 | | |
831 | 831 | | |
832 | 832 | | |
| |||
893 | 893 | | |
894 | 894 | | |
895 | 895 | | |
896 | | - | |
897 | | - | |
898 | 896 | | |
899 | 897 | | |
900 | 898 | | |
| |||
1477 | 1475 | | |
1478 | 1476 | | |
1479 | 1477 | | |
| 1478 | + | |
1480 | 1479 | | |
1481 | 1480 | | |
1482 | 1481 | | |
| |||
1506 | 1505 | | |
1507 | 1506 | | |
1508 | 1507 | | |
| 1508 | + | |
1509 | 1509 | | |
1510 | 1510 | | |
1511 | 1511 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
84 | | - | |
| 83 | + | |
| 84 | + | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| 164 | + | |
164 | 165 | | |
165 | | - | |
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
| |||
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
236 | | - | |
237 | | - | |
238 | 236 | | |
239 | 237 | | |
240 | 238 | | |
| 239 | + | |
241 | 240 | | |
242 | 241 | | |
243 | 242 | | |
| |||
265 | 264 | | |
266 | 265 | | |
267 | 266 | | |
| 267 | + | |
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
| 25 | + | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
0 commit comments