The output of the following code is just list (no number gets printed).
trait TC[A]:
inline def show(value: A): Unit
object TC:
given TC[Int] with
inline def show(value: Int): Unit = println(value)
given[A:TC]: TC[List[A]] with
inline def show(value: List[A]): Unit =
println("list")
value.foreach(x => summon[TC[A]].show(x))
@main
def main: Unit =
import TC._
val value = 1 :: 2 :: 3 :: Nil
summon[TC[List[Int]]].show(value)
If I remove inline then everything will be fine. Am I invoking an undefined behavior?