summaryrefslogtreecommitdiff
path: root/src/library/scala/Enumeration.scala
diff options
context:
space:
mode:
authorScott R. Parish <srp@srparish.net>2012-05-15 08:59:43 -0500
committerScott R. Parish <srp@srparish.net>2012-05-15 08:59:47 -0500
commit0570a9357b7a73842220ff6b465cb7cbd3ae7ea8 (patch)
treeea5603b8c5f765822dba500beefc54acf91c9786 /src/library/scala/Enumeration.scala
parent8a90ca702754b776ae7de120691974332ed77618 (diff)
downloadscala-0570a9357b7a73842220ff6b465cb7cbd3ae7ea8.tar.gz
scala-0570a9357b7a73842220ff6b465cb7cbd3ae7ea8.tar.bz2
scala-0570a9357b7a73842220ff6b465cb7cbd3ae7ea8.zip
Enumeration#maxId: fix documentation to reflect reality
maxId is not really the "maximum id", but rather one past the max: scala> object Foo extends Enumeration { | val x = Value | val y = Value | } defined module Foo scala> Foo.maxId res0: Int = 2 scala> Foo(2) java.util.NoSuchElementException: key not found: 2 at scala.collection.MapLike$class.default(MapLike.scala:225) ... scala> Foo(1) res2: Foo.Value = y
Diffstat (limited to 'src/library/scala/Enumeration.scala')
-rw-r--r--src/library/scala/Enumeration.scala4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/library/scala/Enumeration.scala b/src/library/scala/Enumeration.scala
index ea0d20957d..2b658ee4f7 100644
--- a/src/library/scala/Enumeration.scala
+++ b/src/library/scala/Enumeration.scala
@@ -113,8 +113,8 @@ abstract class Enumeration (initial: Int) extends Serializable {
* enumeration, but no higher than 0. */
private var bottomId = if(initial < 0) initial else 0
- /** The highest integer amongst those used to identify values in this
- * enumeration. */
+ /** The one higher than the highest integer amongst those used to identify
+ * values in this enumeration. */
final def maxId = topId
/** The value of this enumeration with given id `x`