http://sassa-nf.livejournal.com/ ([identity profile] sassa-nf.livejournal.com) wrote in [personal profile] juan_gandhi 2013-01-24 01:19 pm (UTC)

ну это совсем странно. или не очень понятно.

    implicit def safeCast[Z,Y, _ >: Z <: Y]( z:Z ):Y = z.asInstanceOf[Y]
    def asInt( x: Int ): Int = x
    case class L[X](val x: X) { def double[_ >: X <: Int]: Int = asInt(x)*2 }

a.this.safeCast is not a valid implicit value for X => Int because:
incompatible: (z: X)X does not match expected type X => Int
a.this.safeCast is not a valid implicit value for => X => Int because:
incompatible: (z: X)X does not match expected type => X => Int
...(и ещё куча)

тут уже я даже сказал, чему x должен быть равен. На входе в asInt должен быть Int, почему не пробует safeCast с Z=X, Y=Int?

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting