-
Notifications
You must be signed in to change notification settings - Fork 21
package object misbehaves in the presence of classfiles #4695
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
Comments
Imported From: https://issues.scala-lang.org/browse/SI-4695?orig=1 |
@adriaanm said: |
@som-snytt said: how can getCommonSuperclass() do its job if different class symbols get the same bytecode-level internal name: top/baz/package$
...
at scala.tools.nsc.backend.jvm.GenASM$JBuilder.javaName(GenASM.scala:611)
at scala.tools.nsc.backend.jvm.GenASM$JBuilder$$anonfun$addInnerClasses$4.apply(GenASM.scala:704)
at scala.tools.nsc.backend.jvm.GenASM$JBuilder$$anonfun$addInnerClasses$4.apply(GenASM.scala:698)
at scala.collection.immutable.List.foreach(List.scala:309)
at scala.tools.nsc.backend.jvm.GenASM$JBuilder.addInnerClasses(GenASM.scala:698)
at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder.genClass(GenASM.scala:1476)
at scala.tools.nsc.backend.jvm.GenASM$AsmPhase.run(GenASM.scala:180) It must be serious when the message is a rhetorical question. |
@retronym said: retronym/scala@2.10.0-wip...retronym:topic/package-object-stub-flakiness I'm going to take a look at this one. |
@retronym said: package object demo extends demo.A Martin suggests that if we took a strict approach we would outlaw this with a cyclic reference error, as it is conceptually the same manner as: scala> object demo extends demo.A {
| trait A
| }
<console>:7: error: illegal cyclic reference involving object demo
object demo extends demo.A {
^ This would break quite a lot of code, as nested types in the package are the most appealing for the package object to inherit. So we would have to deprecate it, or just leave it in a "use-at-your-own-risk" zone. We can tailor the error message for package objects to suggest a clean build. However, if there is enough will to make this work, there might be a way. In this patch, I detect if any parents of a package module loaded from a classfile is missing (ie, is a stub symbol). If so, we pretend that we didn't see the package.class at all. At the conclusion of the run, we can check that the a package module we discarded was indeed reconstructed from sources. retronym/scala@scala:2.10.0-wip...retronym:ticket/4695 I'm going to sit on this one for a while; comments are very welcome. |
@harrah said: |
@odersky said:
|
@adriaanm said: |
@paulp said: |
@adriaanm said: |
@retronym said: |
@dwijnand said: |
s/wont-fix/have-fixed/ |
Multiple issues here. (And that's before I get to the question of whether one's companion object can be a package object -- although I assume the answer is "no", I find nothing unambiguous in the spec.)
Edit: Another, possibly more serious, related issue follows. Example from mark harrah.
It fails even when given all the source files it has just compiled:
The text was updated successfully, but these errors were encountered: