sbt / sbt-remote-control

Create and manage sbt process using unicorns and forks
Other
74 stars 14 forks source link

`sbt.protocol.LogMessage` should be a sealed trait #285

Open kiritsuku opened 9 years ago

kiritsuku commented 9 years ago

The current definition of LogMessage is:

object LogMessage {
  val DEBUG = "debug"
  val INFO = "info"
  val WARN = "warn"
  val ERROR = "error"
  private[protocol] val validLevels = Set(DEBUG, INFO, WARN, ERROR)
}

Instead, it should be implemented by something like:

sealed trait LogMessage
case object Debug extends Message
case object Info extends Message
case object Warn extends Message
case object Error extends Message

This would allow the compiler to provide exhaustive warnings in pattern match expressions.

havocp commented 9 years ago

I think we have to leave this one open until we break ABI next, but it's a good point.

jsuereth commented 9 years ago

not sure it breaks ABI, but it would break source compat.