import org.scalatest.{Matchers, Suite, WordSpecLike}
trait BaseSp[@specialized(Long, Double) S]{
def initialValue: S
var value: S = initialValue
}
trait BaseNotSp[S]{
def initialValue: S
var value: S = initialValue
}
final class Bar_Sp_Sp [@specialized(Long, Double) S](val initialValue: S) extends BaseSp[S]
final class Bar_NotSp_Sp [@specialized(Long, Double) S](val initialValue: S) extends BaseSp[S]
final class Bar_Sp_NotSp [@specialized(Long, Double) S](val initialValue: S) extends BaseNotSp[S]
final class Bar_NotSp_NotSp [S](val initialValue: S) extends BaseNotSp[S]
class CrashSpec extends Suite with WordSpecLike with Matchers {
"How to reproduce" in {
intercept[ClassCastException](new Bar_Sp_Sp[Double](Double.MaxValue)).getMessage should equal(null)
intercept[ClassCastException](new Bar_Sp_Sp[Long](Long.MaxValue)).getMessage should equal("java.lang.Long cannot be cast to java.lang.Double")
intercept[ClassCastException](new Bar_NotSp_Sp[Double](Double.MaxValue)).getMessage should equal(null)
intercept[ClassCastException](new Bar_NotSp_Sp[Long](Long.MaxValue)).getMessage should equal("java.lang.Long cannot be cast to java.lang.Double")
new Bar_Sp_NotSp[Double](Double.MaxValue)
new Bar_Sp_NotSp[Long](Long.MaxValue)
new Bar_NotSp_NotSp[Double](Double.MaxValue)
new Bar_NotSp_NotSp[Long](Long.MaxValue)
}
}