summaryrefslogtreecommitdiff
path: root/test/files/run/t3950.scala
blob: 58466e13fbc4e2c1d1dc8195e5be470fdd6084d9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
object NegativeId extends Enumeration {
  val Negative = Value(-1, "minus")
  val Zero = Value(0, "zero")
  val Positive = Value(1, "plus")

  def fromInt(id: Int) = values find (_.id == id) match {
    case Some(v) => v
    case None => null
  }
}

object Test extends App {
  println(NegativeId.fromInt(-1))
  println(NegativeId.fromInt(0))
  println(NegativeId.fromInt(1))
}