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

Assertion failed while re-compiling a package object containing a case class #2130

Closed
scabug opened this issue Jul 7, 2009 · 3 comments
Closed
Assignees

Comments

@scabug
Copy link

scabug commented Jul 7, 2009

While playing with the latest 2.8 snapshot (r18215-b20090706020217 to be precise) I noticed that a package object containing a case class gets an assertion failure when re-compiling (i.e., the class files already exist from a previous run, even a previous build of the exact same source). A minimal test case:

package object foo {
case class X()
}

And the error:

Exception in thread "main" java.lang.AssertionError: assertion failed: List(object package$$X, object package$$X)
at scala.Predef$$.assert(Predef.scala:97)
at scala.tools.nsc.symtab.Symbols$$Symbol.suchThat(Symbols.scala:988)
at scala.tools.nsc.symtab.Symbols$$Symbol.linkedModuleOfClass(Symbols.scala:1159)
at scala.tools.nsc.backend.jvm.GenJVM$$BytecodeGenerator.genClass(GenJVM.scala:203)
at scala.tools.nsc.backend.jvm.GenJVM$$JvmPhase$$$$anonfun$$run$$2.apply(GenJVM.scala:50)
at scala.tools.nsc.backend.jvm.GenJVM$$JvmPhase$$$$anonfun$$run$$2.apply(GenJVM.scala:50)
at scala.collection.Iterator$$class.foreach(Iterator.scala:500)
at scala.collection.generic.MapTemplate$$$$anon$$4.foreach(MapTemplate.scala:156)
at scala.tools.nsc.backend.jvm.GenJVM$$JvmPhase.run(GenJVM.scala:50)
at scala.tools.nsc.Global$$Run.compileSources(Global.scala:781)
at scala.tools.nsc.Global$$Run.compile(Global.scala:855)
at scala.tools.nsc.Main$$.process(Main.scala:75)
at scala.tools.nsc.Main$$.main(Main.scala:89)
at scala.tools.nsc.Main.main(Main.scala)

A normal class does not cause the failure; nor does a case object.

@scabug
Copy link
Author

scabug commented Jul 7, 2009

Imported From: https://issues.scala-lang.org/browse/SI-2130?orig=1
Reporter: rjm

@scabug
Copy link
Author

scabug commented Oct 12, 2009

@odersky said:
For the moment I fixed this by excluding case classes in package objects. They do not make sense anyway.

@scabug
Copy link
Author

scabug commented Feb 20, 2011

@paulp said:
(In r24311) Observed that some historical issues with package objects no longer
seem so issuey. In the interests of keeping the arbitrary limitations
to a minimum, re-enabled case classes in package objects (see #2130, #3437.)
Closes #3437, review by odersky.

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

No branches or pull requests

2 participants