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

wrongly positive array matching #6695

Closed
scabug opened this issue Nov 21, 2012 · 2 comments
Closed

wrongly positive array matching #6695

scabug opened this issue Nov 21, 2012 · 2 comments
Assignees
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Nov 21, 2012

There is wrongly positive matching in the following piece of code. Piece of code prints "wrongly positive" when one could expect no match exception.
I found this bug in production code and wrote this small reproducing snapshort

Array("a", "b", "c") match {
case Array("a", "x", "c") => println("x"); 
case Array("a", "b", "x") => println("a"); 
case Array("a", "d", _*) => println("wrongly positive")
}

Result: wrongly positive

The interesting thing about this code that without the first case it works correctly.

@scabug
Copy link
Author

@scabug scabug commented Nov 21, 2012

Imported From: https://issues.scala-lang.org/browse/SI-6695?orig=1
Reporter: Pavel Girs (orororu)
Affected Versions: 2.9.1, 2.9.2
Duplicates #1697, #2337

@scabug
Copy link
Author

@scabug scabug commented Nov 21, 2012

@retronym said:
Already fixed in 2.10.0, test cases added for 2.10.1:

scala/scala#1653

@scabug scabug closed this Nov 24, 2012
@scabug scabug added this to the 2.10.0 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants