Compiler version
3.0.0-RC2
Minimized code
Mind the missing inline before erasedValue[T]. With inline erasedValue[T] it works as expected
inline def length[T]: Int =
erasedValue[T] match
case _: (h *: t) => 1 + length[t]
case _: EmptyTuple => 0
Output
[info] compiling 1 Scala source to /Users/michal/programming/scala/scala3-example-project/target/scala-3.0.0-RC2/classes
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "classloader-cache-cleanup-0"