aboutsummaryrefslogblamecommitdiff
path: root/tests/run/t3950.scala
blob: 4634b3bf0bbdf878ae92da135c07f8fd63d3e81d (plain) (tree)
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 dotty.runtime.LegacyApp {
  println(NegativeId.fromInt(-1))
  println(NegativeId.fromInt(0))
  println(NegativeId.fromInt(1))
}