Aladdin - Scala Bugtracking
[#432] project: compiler priority: medium category: bug
submitter assigned to status date submitted
Gilles Martin fixed 2005-05-23 13:50:55.0
subject There cannot be an object with the same name as a case class
code
case class Tata;
object Tata;
what happened
Exception in thread "main" java.lang.Error: assertion failed: List(method Tata,object Tata)
        at scala.Predef$.assert(Predef.scala:171)
        at scala.tools.nsc.symtab.Symbols$Symbol.suchThat(Symbols.scala:507)
        at scala.tools.nsc.symtab.Symbols$Symbol.linkedSym(Symbols.scala:600)
        at scala.tools.nsc.symtab.classfile.Pickler$PicklePhase.pickle$0(Pickler.scala:45)
        at scala.tools.nsc.symtab.classfile.Pickler$PicklePhase$$anonfun$0.apply(Pickler.scala:40)
        at scala.tools.nsc.symtab.classfile.Pickler$PicklePhase$$anonfun$0.apply(Pickler.scala:40)
        at scala.List.foreach(List.scala:681)
        at scala.tools.nsc.symtab.classfile.Pickler$PicklePhase.pickle$0(Pickler.scala:40)
        at scala.tools.nsc.symtab.classfile.Pickler$PicklePhase.apply(Pickler.scala:50)
        at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:213)
        at scala.tools.nsc.Global$GlobalPhase$$anonfun$1.apply(Global.scala:202)
        at scala.tools.nsc.Global$GlobalPhase$$anonfun$1.apply(Global.scala:202)
        at scala.Iterator$class.foreach(Iterator.scala:285)
        at scala.collection.mutable.ListBuffer$$anon$0.foreach(ListBuffer.scala:216)
        at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:202)
        at scala.tools.nsc.Global$Run.compileSources(Global.scala:427)
        at scala.tools.nsc.Global$Run.compile(Global.scala:485)
        at scala.tools.nsc.Main$.process(Main.scala:60)
        at scala.tools.nsc.Main$.main(Main.scala:80)
        at scala.tools.nsc.Main.main(Main.scala)
what expected A sensible error message and no crash.
[back to overview]
Changes of this bug report
Gilles  edited on  2005-05-25 13:41:04.0
Gilles  edited on  2005-05-26 17:47:27.0
Gilles  edited on  2005-05-31 16:07:42.0
Actually, this is a feature :-( A possible and partial workaround when the object is used to store view functions is to declare the view on the superclass and match from there. The error message should still be changed, so the bug remains open but its priority drops to low.
Gilles  edited on  2006-03-24 17:53:48.0
Updated "what happened" to Scala 2
Martin  edited on  2006-03-27 23:16:06.0
Martin  edited on  2006-03-27 23:16:42.0