Commit afb4806
authored
Discourage default arg for extension receiver (#22492)
Fixes #12460
I shied away from making it an error, as that is a language change that
violates the rule that extension methods are ordinary methods. There are
other restrictions, but an extension always allows explicit invocation
`m()(x)` that could leverage a default.
The caret is wrong on the second test case (~todo~). Edit: span of
default getter was union of first parameter and the param RHS, so that
the synthetic position of the getter symbol was a point at the first
parameter. Now the getter tree gets the span of the RHS. (That span is
non-synthetic, but the definition is still synthetic. The name pos of a
synthetic is the point.)1 parent 4952e0a commit afb4806
File tree
6 files changed
+62
-9
lines changed- compiler/src/dotty/tools/dotc
- ast
- reporting
- typer
- tests/warn
6 files changed
+62
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
418 | 418 | | |
419 | 419 | | |
420 | 420 | | |
| 421 | + | |
421 | 422 | | |
422 | 423 | | |
423 | 424 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
| 224 | + | |
224 | 225 | | |
225 | 226 | | |
226 | 227 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2514 | 2514 | | |
2515 | 2515 | | |
2516 | 2516 | | |
| 2517 | + | |
| 2518 | + | |
| 2519 | + | |
| 2520 | + | |
| 2521 | + | |
| 2522 | + | |
| 2523 | + | |
| 2524 | + | |
| 2525 | + | |
| 2526 | + | |
| 2527 | + | |
2517 | 2528 | | |
2518 | 2529 | | |
2519 | 2530 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1163 | 1163 | | |
1164 | 1164 | | |
1165 | 1165 | | |
1166 | | - | |
| 1166 | + | |
1167 | 1167 | | |
1168 | | - | |
1169 | | - | |
| 1168 | + | |
1170 | 1169 | | |
1171 | | - | |
1172 | | - | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
1173 | 1173 | | |
1174 | 1174 | | |
1175 | | - | |
1176 | | - | |
| 1175 | + | |
1177 | 1176 | | |
1178 | 1177 | | |
1179 | 1178 | | |
1180 | 1179 | | |
1181 | | - | |
| 1180 | + | |
1182 | 1181 | | |
1183 | 1182 | | |
1184 | 1183 | | |
| |||
1190 | 1189 | | |
1191 | 1190 | | |
1192 | 1191 | | |
1193 | | - | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
1194 | 1201 | | |
1195 | 1202 | | |
1196 | 1203 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
0 commit comments