fork download
  1. object Main extends Application {
  2. implicit def safeCast[X,Y, _ >: X <: Y]( x:X ):Y = x.asInstanceOf[Y]
  3. case class L[X](val x: X) { def double[_ >: X <: Int] = x.asInstanceOf[Int]*2 }
  4.  
  5. override def main(args: Array[String]) = {
  6. println(L(42).double)
  7. }
  8. }
Success #stdin #stdout 0.27s 247552KB
stdin
Standard input is empty
stdout
84