abstract classImplicitConverter[-T, +U] extends (T) ⇒ U
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: ImplicitConverter[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 in Implicits#discardForView which emulates the
conversion in a more efficient way.
Note that this is a SAM class - function literals are automatically converted
to ImplicitConverter values.
Also note that in bootstrapped dotty, Predef.<:< should inherit from
ImplicitConverter. This would cut the number of special cases in
discardForView from two to one.
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: ImplicitConverter[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 in
Implicits#discardForView
which emulates the conversion in a more efficient way.Note that this is a SAM class - function literals are automatically converted to
ImplicitConverter
values.Also note that in bootstrapped dotty,
Predef.<:<
should inherit fromImplicitConverter
. This would cut the number of special cases indiscardForView
from two to one.