Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iterating over Enumeration causes an additional enumeration value to be added #4045

Closed
scabug opened this issue Nov 30, 2010 · 2 comments
Closed

Comments

@scabug
Copy link

scabug commented Nov 30, 2010

What steps will reproduce the problem (please be specific and use wikiformatting)?

  scala> object MyEnum extends Enumeration {val V1, V2, V3=Value}
defined module MyEnum

scala> MyEnum.values.size
res0: Int = 3

scala> MyEnum.values.mkString
res1: String = V1V2V3

scala> MyEnum.values.size
res2: Int = 4

scala> MyEnum.values.mkString(" ")
res3: String = V1 V2 V3 Value

What is the expected behavior?

MyEnum.values.size should not change.

What do you see instead?

The first time MyEnum.values is iterated over, a new value is added to the enumeration, with name "Value."

What versions of the following are you using?

Scala: 2.8.1 (problem was not present in 2.8.0). Reproduced in scala-2.8.1.r23473-b20101109023137

Java: build 1.6.0_20-b02-279-10M3065

Operating system: Mac OS X 10.6.4

@scabug
Copy link
Author

scabug commented Nov 30, 2010

Imported From: https://issues.scala-lang.org/browse/SI-4045?orig=1
Reporter: Alec Wysoker (alecw)
See #5211

@scabug
Copy link
Author

scabug commented Nov 30, 2010

@hubertp said:
Duplicate of #3687 => closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant