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
Nesting of @static field and separate compilation definition-site and call-site causes compiler crash in icode phase with message "no-symbol does not have an owner" #6236
Comments
Imported From: https://issues.scala-lang.org/browse/SI-6236?orig=1 |
@paulp said: // a.scala
package p {
object x {
object x {
@scala.annotation.static val foo: Int = 353
}
}
}
// b.scala - separately compiled
object Test {
def main(args: Array[String]): Unit = {
println(p.x.x.foo)
}
} |
DaveScala (davescala) said: |
@axel22 said: Compiled from "file_1.scala"
public class p.x$x extends java.lang.Object
SourceFile: "file_1.scala"
Scala: length = 0x
...
const #20 = Asciz SourceFile;
const #21 = Asciz Scala;
{
public static int foo;
...
}
During the second compilation, during icode, members of Scope{
def <init>(): p.y$x;
final def $asInstanceOf[T0 >: ? <: ?](): T0;
final def $isInstanceOf[T0 >: ? <: ?](): Boolean;
final def synchronized(x$1: Object): Object;
final def ##(): Int;
final def !=(x$1: Object): Boolean;
final def ==(x$1: Object): Boolean;
final def ne(x$1: Object): Boolean;
final def eq(x$1: Object): Boolean;
protected[package lang] def finalize(): Unit;
final def wait(): Unit;
final def wait(x$1: Long,x$2: Int): Unit;
final def wait(x$1: Long): Unit;
final def notifyAll(): Unit;
final def notify(): Unit;
def toString(): String;
protected[package lang] def clone(): Object;
def equals(x$1: Object): Boolean;
def hashCode(): Int;
final def getClass(): Class;
def <init>(): Object
} |
@paulp said: If I change this: val hostClass = qual.tpe.typeSymbol.orElse(sym.owner).companionClass Not to call companionClass, then it finds the field foo and stops crashing. Of course then it fails at runtime with "java.lang.NoSuchFieldError: foo" because the confusion surrounding this is not so nicely localized. |
@paulp said: |
@axel22 said: I still call the |
@axel22 said (edited on Aug 17, 2012 8:16:31 AM UTC): |
@axel22 said: |
see
https://groups.google.com/forum/?fromgroups#!topic/scala-internals/RA8xNVri60s%5B1-25%5D
The text was updated successfully, but these errors were encountered: