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

Bug in run/structural.scala test #9726

Closed
scabug opened this issue Mar 30, 2016 · 2 comments
Closed

Bug in run/structural.scala test #9726

scabug opened this issue Mar 30, 2016 · 2 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Mar 30, 2016

At line 91 in run/structural.scala , the test checks that the value of "r.p(0).hashCode()" is > 0. Object.hashcode() is not guaranteed to return a positive value. Oracle JVMs seems to always return a positive value, but this is implementation specific detail. Further, I'm not entirely sure what the check is aimed to test. Even in the case where hashCode() only returns positive values, all that would prove is that "r.p(0)" successfully resolves to any object.

@scabug
Copy link
Author

scabug commented Mar 30, 2016

Imported From: https://issues.scala-lang.org/browse/SI-9726?orig=1
Reporter: Devin Nakamura (devin122)
Affected Versions: 2.12.0-M3

@scabug
Copy link
Author

scabug commented Mar 31, 2016

@retronym said (edited on Mar 31, 2016 3:45:32 AM UTC):
I agree that looks fragile. I'd suggest replacing it with .toString() == "ohone"

I assume the test is making sure that the typechecker allows calls like:

def foo(x: { def y: Array[AnyRef] }): String = x.y(0).toString

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

4 participants