Given:
implicit class WithRetType[T, U](x: T => U) {
type Ret = U
}
val foo = (_: Int) * 2
val x: foo.Ret = 3
gives:
error: type Ret is not a member of Int => Int
val x: foo.Ret = ???
^
the following is true:
val foo = (_: Int) * 2
val fooR = new WithRetType(foo)
val x: fooR.Ret = 3
Are implicit conversions allowed to access members that are types?
source
share