Skip to content

Commit 4408853

Browse files
committed
Add doc comments on Conversion methods
1 parent bc5c09b commit 4408853

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

library/src/scala/Conversion.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,16 @@ package scala
1717
* Also note that in bootstrapped dotty, `Predef.<:<` should inherit from
1818
* `Conversion`. This would cut the number of special cases in `discardForView`
1919
* from two to one.
20+
*
21+
* The `Conversion` class can also be used to convert explicitly, using
22+
* the `into` extension method.
2023
*/
2124
@java.lang.FunctionalInterface
2225
abstract class Conversion[-T, +U] extends Function1[T, U]:
26+
/** Convert value `x` of type `T` to type `U` */
2327
def apply(x: T): U
2428
object Conversion:
29+
2530
extension [T](x: T)
31+
/** `x.into[U]` converts a value `x` of type `T` to type `U` */
2632
def into[U](using c: Conversion[T, U]) = c(x)

0 commit comments

Comments
 (0)