Skip to content

Commit 4ed2444

Browse files
committed
Require Conversion to be pure
1 parent aaceb12 commit 4ed2444

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
@@ -1149,6 +1149,7 @@ class Definitions {
11491149
"reactor.util.annotation.NonNullApi" ::
11501150
"io.reactivex.annotations.NonNull" :: Nil)
11511151

1152+
11521153
// convenient one-parameter method types
11531154
def methOfAny(tp: Type): MethodType = MethodType(List(AnyType), tp)
11541155
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)