diff options
author | Philipp Haller <hallerp@gmail.com> | 2009-10-27 18:10:35 +0000 |
---|---|---|
committer | Philipp Haller <hallerp@gmail.com> | 2009-10-27 18:10:35 +0000 |
commit | 3a08cbbb97df78b056db97ab0898114d52ef2ead (patch) | |
tree | 458638d05a61fd3ec7ffba344d05a9c8a59c3f8f /test | |
parent | 727490ab53bdda68b36a9e38a729471094c4e6b5 (diff) | |
download | scala-3a08cbbb97df78b056db97ab0898114d52ef2ead.tar.gz scala-3a08cbbb97df78b056db97ab0898114d52ef2ead.tar.bz2 scala-3a08cbbb97df78b056db97ab0898114d52ef2ead.zip |
Improves Enumeration to obtain names of values ...
Improves Enumeration to obtain names of values through reflection. This
addresses those parts of #2111 that we agreed on in the Scala meeting.
Diffstat (limited to 'test')
-rw-r--r-- | test/files/run/t2111.check | 6 | ||||
-rw-r--r-- | test/files/run/t2111.scala | 20 |
2 files changed, 26 insertions, 0 deletions
diff --git a/test/files/run/t2111.check b/test/files/run/t2111.check new file mode 100644 index 0000000000..0fc64f38ed --- /dev/null +++ b/test/files/run/t2111.check @@ -0,0 +1,6 @@ +Red +Green +Blue +Blue +Green +Red diff --git a/test/files/run/t2111.scala b/test/files/run/t2111.scala new file mode 100644 index 0000000000..3c6c5b8e8f --- /dev/null +++ b/test/files/run/t2111.scala @@ -0,0 +1,20 @@ + +object Test extends Application { + + object Color extends Enumeration { + val Red, Green, Blue = Value + } + + class MyColor extends Enumeration { + val Red, Green, Blue = Value + } + + println(Color.Red) + println(Color.Green) + println(Color.Blue) + val col = new MyColor + println(col.Blue) + println(col.Green) + println(col.Red) + +} |