new warnings in 2.10 for enumerations

38 views
Skip to first unread message

Russ P.

unread,
May 19, 2013, 11:33:48 PM5/19/13
to scala...@googlegroups.com
I just upgraded from 2.9.2 to 2.10.1, and I am getting warnings that I did not get before. Here's the relevant code:

sealed trait ManeuverType

object ManeuverType { // enumeration of maneuver types

    case object alt extends ManeuverType // altitude maneuver
    case object vec extends ManeuverType // horizontal "vector" maneuver
    case object spd extends ManeuverType // speed manevuer
    }

And here are the warnings:

[warn] /home/Maneuver.scala:12: dead code following this
construct
[warn]     case object alt extends ManeuverType // altitude maneuver
[warn]                 ^
[warn] /home/Maneuver.scala:13: dead code following this
construct
[warn]     case object vec extends ManeuverType // horizontal "vector" maneuver
[warn]                 ^
[warn] /home/Maneuver.scala:14: dead code following this
construct
[warn]     case object spd extends ManeuverType // speed manevuer
[warn] 

What changed in the language or compiler to cause these warnings? Thanks.

--Russ P.                ^

Jason Zaugg

unread,
May 19, 2013, 11:54:29 PM5/19/13
to Russ P., scala-user
I'm unable to reproduce. What compiler options are you using.

Here's what I tried:

  /code/scala cat sandbox/rp.scala
sealed trait ManeuverType

object ManeuverType { // enumeration of maneuver types

  case object alt extends ManeuverType // altitude maneuver
  case object vec extends ManeuverType // horizontal "vector" maneuver
  case object spd extends ManeuverType // speed manevuer
}
  /code/scala RUNNER=scalac scala-hash v2.10.1 -Ydead-code sandbox/rp.scala
[info] v2.10.1 => /Users/jason/usr/scala-v2.10.1-0-g77b864e
  /code/scala RUNNER=scalac scala-hash v2.10.0 -Ydead-code sandbox/rp.scala
[info] v2.10.0 => /Users/jason/usr/scala-v2.10.0-0-g18481ce 

-jason

Jason Zaugg

unread,
May 20, 2013, 12:09:42 AM5/20/13
to Russ P., scala-user
On Mon, May 20, 2013 at 5:54 AM, Jason Zaugg <jza...@gmail.com> wrote:
On Mon, May 20, 2013 at 5:33 AM, Russ P. <russ.p...@gmail.com> wrote:
I just upgraded from 2.9.2 to 2.10.1, and I am getting warnings that I did not get before. Here's the relevant code:

sealed trait ManeuverType

object ManeuverType { // enumeration of maneuver types

    case object alt extends ManeuverType // altitude maneuver
    case object vec extends ManeuverType // horizontal "vector" maneuver
    case object spd extends ManeuverType // speed manevuer
    }

And here are the warnings:

[warn] /home/Maneuver.scala:12: dead code following this
construct
[warn]     case object alt extends ManeuverType // altitude maneuver
[warn]                 ^
[warn] /home/Maneuver.scala:13: dead code following this
construct
[warn]     case object vec extends ManeuverType // horizontal "vector" maneuver
[warn]                 ^
[warn] /home/Maneuver.scala:14: dead code following this
construct
[warn]     case object spd extends ManeuverType // speed manevuer
[warn] 

What changed in the language or compiler to cause these warnings? Thanks.


It is fixed in the forthcoming release, 2.10.2. We've just had a code freeze for the first release candidate, so it's not far away.

Until then, remove -Ywarn-dead-code.

-jason 

Reply all
Reply to author
Forward
0 new messages