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

Enumeration.values adds new element named "Value" #4292

Closed
scabug opened this issue Feb 23, 2011 · 2 comments
Closed

Enumeration.values adds new element named "Value" #4292

scabug opened this issue Feb 23, 2011 · 2 comments

Comments

@scabug
Copy link

scabug commented Feb 23, 2011

object SomeEnum extends Enumeration {
	type SomeEnum = Value;
	val ONE, TWO = Value;
}

object EnumTest {

	def main (args : Array[String]) {
		println(SomeEnum.values.size)
		println(SomeEnum.values);
		println(SomeEnum.values.size);
		println(SomeEnum.values);
	}
}

Should result in:

2
SomeEnum.ValueSet(ONE, TWO)
2
SomeEnum.ValueSet(ONE, TWO)

But results in adding "Value" as new element of !SomeEnum:

2
SomeEnum.ValueSet(ONE, TWO)
3
SomeEnum.ValueSet(ONE, TWO, Value)

It doesn't work with:

  • Scala: 2.8.1.final
  • Java: Java !HotSpot(TM) Client VM (build 1.5.0_17-b04, mixed mode, sharing)
  • Operating system: Windows XP
    It works as expected with Scala 2.8.0.final.
    Clearly there was some bug introduced to Enumeration implementation between those versions - maybe something related to Enumeration.values is confused by methods returning Val instances #3616.
@scabug
Copy link
Author

scabug commented Feb 23, 2011

Imported From: https://issues.scala-lang.org/browse/SI-4292?orig=1
Reporter: jaroslaw.wosik
Attachments:

@scabug
Copy link
Author

scabug commented Feb 24, 2011

@soc said:
Works in 2.9 trunk, seems to be duplicate of #4045, #3687.

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