Make Compile Fail on Non-Exhaustive Match in SBT
问题 Let's say that I have a trait, Parent, with one child, Child. scala> sealed trait Parent defined trait Parent scala> case object Boy extends Parent defined module Boy I write a function that pattern matches on the sealed trait. My f function is total since there's only a single Parent instance. scala> def f(p: Parent): Boolean = p match { | case Boy => true | } f: (p: Parent)Boolean Then, 2 months later, I decide to add a Girl child of Parent . scala> case object Girl extends Parent defined