From 3a08cbbb97df78b056db97ab0898114d52ef2ead Mon Sep 17 00:00:00 2001 From: Philipp Haller Date: Tue, 27 Oct 2009 18:10:35 +0000 Subject: 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. --- test/files/run/t2111.check | 6 ++++++ test/files/run/t2111.scala | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 test/files/run/t2111.check create mode 100644 test/files/run/t2111.scala (limited to 'test/files') 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) + +} -- cgit v1.2.3