
Can anybody tell me why this code takes endless time to compile? What is the compiler doing so much and how can I help it?--You can find full source code here:sealed trait C
case object C1 extends C
case object C2 extends C
case object C3 extends C...case object C399 extends C
case object C400 extends C
object M {
def f(c: C): Int = c match {
case C1 => 1
case C2 => 2
case C3 => 3
...
case C399 => 399
case C400 => 400
}
}
You received this message because you are subscribed to the Google Groups "scala-debate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-debate+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I've just been notified on Twitter by a friendly observer that this doesn't happen in Scala 2.11.4, so it's a recent regression.
You can avoid this by downgrading to Scala 2.11.4 or using -Xno-patmat-analysis (which turns off exhaustivity checking).
Or more locally by (scrutinee: Any) match { ... }.