Skip to content

Commit cab9e68

Browse files
committed
Require Conversion to be pure
1 parent 20f0bbd commit cab9e68

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

compiler/src/dotty/tools/dotc/core/Definitions.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,6 +1148,7 @@ class Definitions {
11481148
"reactor.util.annotation.NonNullApi" ::
11491149
"io.reactivex.annotations.NonNull" :: Nil)
11501150

1151+
11511152
// convenient one-parameter method types
11521153
def methOfAny(tp: Type): MethodType = MethodType(List(AnyType), tp)
11531154
def methOfAnyVal(tp: Type): MethodType = MethodType(List(AnyValType), tp)

library/src/scala/Conversion.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@ import language.experimental.captureChecking
2525
*/
2626
@java.lang.FunctionalInterface
2727
abstract class Conversion[-T, +U] extends Function1[T, U]:
28-
/** Convert value `x` of type `T` to type `U` */
29-
def apply(x: T): U
28+
self =>
29+
/** Convert value `x` of type `T` to type `U` */
30+
def apply(x: T): U
3031

31-
extension (x: T)
32-
/** `x.convert` converts a value `x` of type `T` to type `U` */
33-
def convert = this(x)
32+
extension (x: T)
33+
/** `x.convert` converts a value `x` of type `T` to type `U` */
34+
def convert = this(x)
3435

3536
object Conversion:
3637
import annotation.experimental
@@ -46,5 +47,4 @@ object Conversion:
4647
/** Unwrap an `into` */
4748
extension [T](x: into[T])
4849
@experimental def underlying: T = x
49-
50-
end Conversion
50+
end Conversion

0 commit comments

Comments
 (0)