|
5 | 5 | |---------------------------------------------------------------------------------------------------------------------
|
6 | 6 | | Explanation (enabled by `-explain`)
|
7 | 7 | |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
8 |
| - | Although extensions are ordinary methods, they must be invoked as a selection. |
9 |
| - | Therefore, the receiver cannot be omitted. A default argument for that parameter would never be used. |
| 8 | + | Although extensions are ordinary methods, when they are invoked as a selection, |
| 9 | + | the receiver cannot be omitted. A default argument for that parameter would never be used. |
| 10 | + | An extension method can be invoked as a regular method, but if that is the intended usage, |
| 11 | + | it should not be defined as an extension. |
10 | 12 | ---------------------------------------------------------------------------------------------------------------------
|
11 | 13 | -- [E208] Potential Issue Warning: tests/warn/i12460.scala:5:37 --------------------------------------------------------
|
12 | 14 | 5 |extension (using String)(s: String = "hello, world") def revert = s.reverse.toUpperCase // warn
|
|
15 | 17 | |---------------------------------------------------------------------------------------------------------------------
|
16 | 18 | | Explanation (enabled by `-explain`)
|
17 | 19 | |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
18 |
| - | Although extensions are ordinary methods, they must be invoked as a selection. |
19 |
| - | Therefore, the receiver cannot be omitted. A default argument for that parameter would never be used. |
| 20 | + | Although extensions are ordinary methods, when they are invoked as a selection, |
| 21 | + | the receiver cannot be omitted. A default argument for that parameter would never be used. |
| 22 | + | An extension method can be invoked as a regular method, but if that is the intended usage, |
| 23 | + | it should not be defined as an extension. |
20 | 24 | ---------------------------------------------------------------------------------------------------------------------
|
0 commit comments