Commit db23c08
authored
fix: map name position to desugared version of named context bound (#22374)
resolves: #22335
This PR changes the positions so context bound name position is
correctly mapped in the desugaring:
```scala
def aa[T : Numeric as num]() = ??? // original code
def aa[T >: Nothing <: Any]()(using num: Numeric[T]): Nothing = ??? // desugared code, where position of `num` points to `num` in the original code
```
This also affects the cases where context bound is not named. The
definition position of `evidence$0` changed:
```scala
def aa[T : Numeric]() = ??? // original code
def aa[T >: Nothing <: Any]()(using evidence$0: Numeric[T]): Nothing = ??? // desugared code
// previously position of evidence$0 in original code
def aa[T : <<>>Numeric]() = ???
// after this PR
def aa[T : Numeric<<>>]() = ???
```
Which I think makes sense since if the was a name it would go after the
context boundFile tree
8 files changed
+39
-12
lines changed- compiler/src/dotty/tools/dotc
- ast
- parsing
- typer
- presentation-compiler/test/dotty/tools/pc/tests
- hover
- inlayHints
- tests
- pos/i20901
- semanticdb
- expect
8 files changed
+39
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
275 | | - | |
| 275 | + | |
276 | 276 | | |
277 | | - | |
| 277 | + | |
| 278 | + | |
278 | 279 | | |
279 | 280 | | |
280 | 281 | | |
281 | 282 | | |
282 | 283 | | |
283 | | - | |
284 | | - | |
| 284 | + | |
| 285 | + | |
285 | 286 | | |
286 | | - | |
| 287 | + | |
| 288 | + | |
287 | 289 | | |
288 | 290 | | |
289 | 291 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2265 | 2265 | | |
2266 | 2266 | | |
2267 | 2267 | | |
2268 | | - | |
| 2268 | + | |
| 2269 | + | |
2269 | 2270 | | |
2270 | 2271 | | |
2271 | 2272 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2466 | 2466 | | |
2467 | 2467 | | |
2468 | 2468 | | |
2469 | | - | |
| 2469 | + | |
2470 | 2470 | | |
2471 | 2471 | | |
2472 | 2472 | | |
| |||
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
898 | 898 | | |
899 | 899 | | |
900 | 900 | | |
901 | | - | |
| 901 | + | |
902 | 902 | | |
903 | 903 | | |
904 | 904 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
| 95 | + | |
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2734 | 2734 | | |
2735 | 2735 | | |
2736 | 2736 | | |
2737 | | - | |
| 2737 | + | |
2738 | 2738 | | |
2739 | 2739 | | |
2740 | 2740 | | |
| |||
3668 | 3668 | | |
3669 | 3669 | | |
3670 | 3670 | | |
3671 | | - | |
3672 | 3671 | | |
3673 | 3672 | | |
| 3673 | + | |
3674 | 3674 | | |
3675 | 3675 | | |
3676 | 3676 | | |
| |||
0 commit comments