You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have managed to create the following which fails in many ways; stack overflow, class not found and so on.
The code was written to reproduce the essential behaviour seen in scalax.collection.Graph. I'll report it to that group as I think their use of TypeTags is probably ill-advised.
@xeno-by said:
Yes, that's an unfortunate limitation in how runtime reflection is implemented in 2.10.x. We believe we have fixed this in 2.11.0, but we don't have time to backport the fix to 2.10.5, which means that 2.10.x series will most likely have this as a known issue. Here's a detailed discussion: #6240.
I have managed to create the following which fails in many ways; stack overflow, class not found and so on.
The code was written to reproduce the essential behaviour seen in scalax.collection.Graph. I'll report it to that group as I think their use of TypeTags is probably ill-advised.
I also suspect that this issue is well-known.
import scala.concurrent._
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._
import scala.reflect.runtime.universe._
sealed trait Bar[E]
trait BarA[E] extends Bar[E]
trait BarB[E] extends Bar[E]
trait Foo[N, E[X] <: Bar[X]] {
// doesn't matter if this is def or val - still fails
implicit val typeTag: TypeTag[E[N]]
@transient lazy val isBar = typeTag.tpe.baseClasses contains typeOf[Bar[_]].typeSymbol
}
case class Thing[N, E[X] <: Bar[X]](t: N)(implicit @transient override val typeTag: TypeTag[E[N]]) extends Foo[N, E]
object TypeTagFail extends App {
val f = future {
ThingString, BarA.isBar
}
f.onSuccess{ case _ ⇒ println("f done") }
f.onFailure{ case e ⇒ println("f failed");e.printStackTrace()}
val g = future {
ThingString, BarB.isBar
}
g.onSuccess{ case _ ⇒ println("g done") }
g.onFailure{ case e ⇒ println("g failed"); e.printStackTrace()}
Await.result(f, 60 seconds)
Await.result(g, 60 seconds)
println("Done")
// wait for stack traces
Thread.sleep(1000)
}
The text was updated successfully, but these errors were encountered: