[#549] | project: compiler | priority: high | category: bug | |
---|---|---|---|---|
submitter | assigned to | status | date submitted | |
Martin | Iulian | fixed | 2006-03-16 18:27:05.0 | |
subject | resident compiler does not survive class->object change | |||
code |
class foo {} |
|||
what happened | Compile class above with nsc -resident. Then change `class' in file above to `object'. Compile again with same r\ esident compiler. You get:Exception in thread "main" java.lang.Error: assertion failed: List((object foo,scala.tools.nsc.symtab.classfile.\ Pickler$Pickle@d6b059)) at scala.Predef$.assert(Predef.scala:171) at scala.tools.nsc.Global$Run.compileSources(Global.scala:442) at scala.tools.nsc.Global$Run.compile(Global.scala:480) at scala.tools.nsc.Main$$anonfun$0.apply(Main.scala:39) at scala.tools.nsc.Main$$anonfun$0.apply(Main.scala:36) at scala.tools.nsc.EvalLoop$class.loop(EvalLoop.scala:11) at scala.tools.nsc.Main$.loop(Main.scala:16) at scala.tools.nsc.EvalLoop$class.loop(EvalLoop.scala:12) at scala.tools.nsc.Main$.loop(Main.scala:16) at scala.tools.nsc.Main$.resident(Main.scala:36) at scala.tools.nsc.Main$.process(Main.scala:55) at scala.tools.nsc.Main$.main(Main.scala:80) at scala.tools.nsc.Main.main(Main.scala)Digging further, the assertion violation is caused because no class file is generated for the object, even thoug\ h at the end of phase mixin, a tree is passed to the backend. |
|||
what expected | Successful compilation | |||
[back to overview] |
Iulian edited on 2006-03-17 15:57:21.0 |
The bug appears because of the weird interactions with the (surprise!) classpath. In fact, having the output directory in the classpath seems to cause some trouble. The second run, the compiler will think the 'class foo' is in the classpath, and link it with the now 'object foo'. The backend will not generate a mirror class, because it will clash with the already existing class 'foo' (which we cannot really tell that just changed identity and is now an object...). Right now I decided to actually overwrite such a class if it is not being compiled in the current run. It's probably not the cleanest solution. Maybe better would be to actually erase all files that resulted from the same source files as those being compiled in the current run, before even starting the new compiler run. |