A class for implicit values that can serve as implicit conversions. The implicit resolution algorithm will act as if there existed the additional implicit definition:
def $implicitConversion[T, U](x: T)(c: Conversion[T, U]): U = c(x)
However, the presence of this definition would slow down implicit search since its outermost type matches any pair of types. Therefore, implicit search contains a special case inImplicits#discardForView which emulates the conversion in a more efficient way.
Note that this is a SAM class - function literals are automatically converted to theConversion values.
Also note that in bootstrapped dotty,Predef.<:< should inherit fromConversion. This would cut the number of special cases indiscardForView from two to one.
TheConversion class can also be used to convert explicitly, using theconvert extension method.
Convert valuex of typeT to typeU
Composes two instances ofFunction1 in a newFunction1, with this function applied first.
Composes two instances ofFunction1 in a newFunction1, with this function applied first.
the result type of functiong
a function R => A
a new functionf such thatf(x) == g(apply(x))
Composes two instances ofFunction1 in a newFunction1, with this function applied last.
Composes two instances ofFunction1 in a newFunction1, with this function applied last.
the type to which functiong can be applied
a function A => T1
a new functionf such thatf(x) == apply(g(x))
Returns a string representation of the object.
Returns a string representation of the object.
The default representation is platform dependent.
a string representation of the object.
x.convert converts a valuex of typeT to typeU