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

Error during phase patmat (scala.tools.nsc.typechecker.PatternMatching$Logic$And.equals) #6726

Closed
scabug opened this issue Nov 26, 2012 · 11 comments

Comments

@scabug
Copy link

scabug commented Nov 26, 2012

I am having problems with 2.10-RC2 for this match

Code: https://gist.github.com/8995c2131c5d3e49c629

It compiles fine with 2.9.2.
On eclipse I get a StackOverflow error that suggests me to close the workbench.
On the command line output the compiler shows an error during phase patmat (scala.tools.nsc.typechecker.PatternMatching$Logic$And.equals)

Output: https://gist.github.com/ae82deae3b906a8e8b89

Paul Phillips figured out the problem: the 324 case was there twice. However the compiler should not crash because of this. But it should not compile (also a bug in 2.9.x I guess).

@scabug
Copy link
Author

scabug commented Nov 26, 2012

Imported From: https://issues.scala-lang.org/browse/SI-6726?orig=1
Reporter: Duncan Mac-Vicar P. (duncan)
Affected Versions: 2.10.0-RC2
See #6942
Attachments:

  • example.scala (created on Nov 26, 2012 11:35:47 PM UTC, 2770 bytes)

@scabug
Copy link
Author

scabug commented Nov 27, 2012

@hubertp said:
I hit this long time ago but I couldn't minimize it on my code (I think I sent stacktrace to you, Adriaan, but without the code so it was useless).
So now I experimented a bit and here is pretty dummy generator for the example:

object bugGenerator {
  def main(args: Array[String]) {
    println("trait Foo{")
    println("abstract class Base")
    val max = 2000
    for (x <- Range(0, max)) println("case class Dummy" + x + "(x: Int) extends Base")
    println("def test(y: Base) = y match {")
    for (x <- Range(0, max)) println(" case Dummy" + x + "(p) => p")
    println("}\n}")
  }
}

starts crashing somewhere between 1000 and 2000, even with "-Dscalac.patmat.analysisBudget=off" (apart from the fact that it takes long to compile).

@scabug
Copy link
Author

scabug commented Nov 27, 2012

@hubertp said:
I run it with 8M for stack and it passed (rather than usual 1M). Took it more than 30 minutes to compile though but probably there is nothing we can do about it atm.

@scabug
Copy link
Author

scabug commented Nov 28, 2012

@adriaanm said (edited on Nov 28, 2012 9:26:19 AM UTC):
that needs to be fixed at the root, of course, but in the mean time you can turn off the analysis with the -Xno-patmat-analysis compiler option (this does not affect code generation)

@scabug
Copy link
Author

scabug commented Nov 28, 2012

@hubertp said:
btw I think it would be useful to name this option -Xpatmat-no-analysis or sth similar. Given the number of options we offer having the subject at the beginning is actually useful (I was looking for this one under -Y).

@scabug
Copy link
Author

scabug commented Jan 22, 2013

@retronym said:
Likely related to #6942, I'm checking if this works after the recent patch.

@scabug
Copy link
Author

scabug commented Jan 22, 2013

@retronym said:
I've done a little profiling and tuning over here:

retronym/scala@scala:2.10.x...retronym:ticket/6726

@scabug
Copy link
Author

scabug commented Jan 28, 2013

@retronym said:
scala/scala#1994

@scabug
Copy link
Author

scabug commented Jan 28, 2013

@adriaanm said:
for 2.11 i'd like to solve this by moving to SAT4j

@scabug
Copy link
Author

scabug commented Jan 29, 2013

@adriaanm said:
assigning to Jason since he did the work on tuning

this bug can be closed once his PR is merged -- the SAT4j migration is logged as #6582

@scabug
Copy link
Author

scabug commented Jan 31, 2013

@adriaanm said:
scala/scala#2020

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

2 participants