blob: ce72d13a54ed6615e965b9a6b5e79a88edf4d469 (
plain) (
tree)
|
|
object Test extends App {
abstract class Value {
}
case class Num(value: Int) extends Value {
override def toString = value.toString;
}
implicit def conversions(x: Value) = new {
def toInt =
x match {
case Num(n) => n
case _ => throw new RuntimeException
}
}
def eval(v: Value): Value = {
println("hey")
Num(1)
}
eval(Num(1)).toInt
}
|