File tree Expand file tree Collapse file tree 2 files changed +4
-7
lines changed Expand file tree Collapse file tree 2 files changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -25,8 +25,7 @@ package scala
25
25
abstract class Conversion [- T , + U ] extends Function1 [T , U ]:
26
26
/** Convert value `x` of type `T` to type `U` */
27
27
def apply (x : T ): U
28
- object Conversion :
29
28
30
- extension [ T ] (x : T )
31
- /** `x.convert[U] ` converts a value `x` of type `T` to type `U` */
32
- def convert [ U ]( using c : Conversion [ T , U ]) = c (x)
29
+ extension (x : T )
30
+ /** `x.convert` converts a value `x` of type `T` to type `U` */
31
+ def convert = this (x)
Original file line number Diff line number Diff line change 1
- import Conversion .convert
2
-
3
1
given Conversion [String , Int ] = _.length
4
2
given Conversion [Int , String ] = _.toString
5
3
6
4
def f (x : String ): Int = x.convert
7
- def g (x : Int ): String = x.convert[ String ]
5
+ def g (x : Int ): String = x.convert
You can’t perform that action at this time.
0 commit comments