diff options
Diffstat (limited to 'test/files/run/t3950.scala')
-rw-r--r-- | test/files/run/t3950.scala | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/files/run/t3950.scala b/test/files/run/t3950.scala new file mode 100644 index 0000000000..fe99a7cc6f --- /dev/null +++ b/test/files/run/t3950.scala @@ -0,0 +1,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 Application { + println(NegativeId.fromInt(-1)) + println(NegativeId.fromInt(0)) + println(NegativeId.fromInt(1)) +} |