My motor controller code models commands as trait Command with case class SetSpeed(rpm: Int), case object Stop and case object Reset, handled in one match. Last week a colleague added case object Calibrate and forgot the handler; everything compiled, and the program threw scala.MatchError in the field.
I was told that making the trait sealed would have caught this. What does sealed actually change, and are there cases it does not cover?




