Closed
Description
Minimized code
trait Txn[T <: Txn[T]]
trait Elem[T <: Txn[T]]
trait Obj[T <: Txn[T]] extends Elem[T]
trait Copy[In <: Txn[In], Out <: Txn[Out]] {
def copyImpl[Repr[~ <: Txn[~]] <: Elem[~]](in: Repr[In]): Repr[Out]
def apply[Repr[~ <: Txn[~]] <: Elem[~]](in: Repr[In]): Repr[Out] = {
val out = copyImpl[Repr](in)
(in, out) match {
case (inObj: Obj[In], outObj: Obj[Out]) => // problem here
println("copy the attributes")
case _ =>
}
out
}
}
Output
https://scastie.scala-lang.org/hzmyXFSrRoq4Na9ZMsIkTQ
Recursion limit exceeded.
Maybe there is an illegal cyclic reference?
If that's not the case, you could also try to increase the stacksize using the -Xss JVM option.
A recurring operation is (inner to outer):
subtype de.sciss.lucre.experiment.Txn[
LazyRef(
de.sciss.lucre.experiment.Txn[
LazyRef(
de.sciss.lucre.experiment.Txn[
LazyRef(
de.sciss.lucre.experiment.Txn[
LazyRef(
de.sciss.lucre.experiment.Txn[
LazyRef(
de.sciss.lucre.experiment.Txn[
LazyRef(
de.sciss.lucre.experiment.Txn[
LazyRef(
de.sciss.lucre.experiment.Txn[
LazyRef(
de.sciss.lucre.experiment.Txn[
LazyRef(
de.sciss.lucre.experiment.Txn[
LazyRef(
de.sciss.lucre.experiment.Txn[
LazyRef(...)
]
)
]
)
]
)
]
)
]
)
]
)
]
)
]
)
]
)
]
)
] <:< de.sciss.lucre.experiment.Txn[LazyRef(T)]
subtype LazyRef(T) <:< LazyRef(
de.sciss.lucre.experiment.Txn[
LazyRef(
de.sciss.lucre.experiment.Txn[
LazyRef(
de.sciss.lucre.experiment.Txn[
LazyRef(
de.sciss.lucre.experiment.Txn[
LazyRef(
de.sciss.lucre.experiment.Txn[
LazyRef(
de.sciss.lucre.experiment.Txn[
LazyRef(
de.sciss.lucre.experiment.Txn[
LazyRef(
de.sciss.lucre.experiment.Txn[
LazyRef(
de.sciss.lucre.experiment.Txn[
LazyRef(
de.sciss.lucre.experiment.Txn[
LazyRef(
de.sciss.lucre.experiment.Txn[
LazyRef(...)
]
)
]
)
]
)
]
)
]
)
]
)
]
)
]
)
]
)
]
)
]
)
subtype LazyRef(T) <:< LazyRef(
de.sciss.lucre.experiment.Txn[
...
Expectation
should compile ( https://scastie.scala-lang.org/UL2Je3yATT6MukbzvP0qRA )