In Scala, I am incredibly confused by this fairly tautological error message:
java.lang.ClassCastException: FOO cannot be cast to FOO
I would e
I've run into similar issue, and I've converted my code to use IMain#mostRecentVar introduced in Scala 2.9. Here's from CompilerMatcher I wrote:
val main = new IMain(s)
main.compileSources(files.map(toSourceFile(_)): _*)
code map { c => main.interpret(c) match {
case IR.Error => error("Error interpreting %s" format (c))
case _ =>
}}
val recent = main.mostRecentVar
val holder = main.valueOfTerm(recent)
if (holder != Some(expected))
println("actual: " + holder.map(_.toString).getOrElse{"None"})