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

"no-symbol does not have an owner" with Scala 2.10 (named args side effects on trees) #6921

Closed
scabug opened this issue Jan 5, 2013 · 16 comments
Closed

Comments

@scabug
Copy link

@scabug scabug commented Jan 5, 2013

I'm attempting upgrade from 2.9.2 to 2.10. Code that previously compiled cleanly is now triggering the error "no-symbol does not have an owner" (I'll attach the full output, rather than pasting it in).

I've tried to figure out where the failure was introduced, and I have found that the code compiles successfully at 2.10.0-M1, but the error occurs at 2.10.0-M2.

I don't have a small repro, and I think that I'm not able to share the entire project that hits this problem. I recognise that this is not ideal! I'll play around a bit to see if I can get a smaller repro; if I come up with something that I can share then I will do so. Please advise if there's anything else I can do to help out.

@scabug
Copy link
Author

@scabug scabug commented Jan 5, 2013

Imported From: https://issues.scala-lang.org/browse/SI-6921?orig=1
Reporter: David Hotham (dimbleby)
Affected Versions: 2.10.0
See #7176
Attachments:

@scabug
Copy link
Author

@scabug scabug commented Jan 5, 2013

David Hotham (dimbleby) said:
OK, I've whittled this down to a bite-sized repro - below.

(It looks as though I'm going to be able to work around this by re-naming the "private[this] var reason" so that it doesn't clash with the reason in Message, which will be just fine for me).

sealed abstract class MessageType(val value: Int)
object MessageType {
    case object HELLO extends MessageType(0)
}


sealed abstract class Reason(val value: Int)
object Reason {
    case object GOOD_REASON extends Reason(0)
}


case class Message(messageType:MessageType, reason:Option[Reason] = None)


class ReproForSI6921 {

  private[this] var reason: Reason = Reason.GOOD_REASON

  def decideElection() {
    val explanation = None
    val msg = Message(MessageType.HELLO, reason = explanation)
  }
}

@scabug
Copy link
Author

@scabug scabug commented Mar 5, 2013

Andreas W (andreasw) said:
I am having this problem, suddenly, with 2.10.1-RC2. Seems to have snuck in with an IDE upgrade, since the same code used to work fine before.

This looks like a critical error to me. Is anything being done?

@scabug
Copy link
Author

@scabug scabug commented Mar 5, 2013

Andreas W (andreasw) said:
I was able to also reproduce this error with sbt, using compiler version 2.10.1-RC1. Error message below, in case it helps....

I need to find a solution ASAP, will look into downgrading the IDE compiler first.

[error] no-symbol does not have an owner
unhandled exception while transforming PlateView.scala
[error] uncaught exception during compilation: scala.reflect.internal.FatalError
[error] {file:/home/andreas/Documents/Source/trunk/}firecode/compile:compile: scala.reflect.internal.FatalError:
[error] while compiling: /home/andreas/Documents/Source/trunk/FireCode/src/com/firefly/firecode/gui/PlateView.scala
[error] during phase: global=lambdalift, atPhase=constructors
[error] library version: version 2.10.1-RC1
[error] compiler version: version 2.10.1-RC1
[error] reconstructed args: -d /home/andreas/Documents/Source/trunk/FireCode/target/scala-2.10.1-RC1/classes -bootclasspath /usr/lib/jvm/java-6-openjdk-i386/jre/lib/resources.jar:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/rt.jar:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/jsse.jar:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/jce.jar:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/charsets.jar:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/netx.jar:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/plugin.jar:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/rhino.jar:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/modules/jdk.boot.jar:/usr/lib/jvm/java-6-openjdk-i386/jre/classes:/home/andreas/.sbt/boot/scala-2.10.1-RC1/lib/scala-library.jar -classpath /home/andreas/Documents/Source/trunk/FireCode/target/scala-2.10.1-RC1/classes:/home/andreas/Documents/Source/trunk/Gui/target/scala-2.10.1-RC1/classes:/home/andreas/Documents/Source/trunk/Core/target/scala-2.10.1-RC1/classes:/home/andreas/Documents/Source/trunk/Report/target/scala-2.10.1-RC1/classes:/home/andreas/Documents/Source/trunk/external/scalabeans/target/scala-2.10.1-RC1/classes:/home/andreas/Documents/Source/trunk/external/gtkjfilechooser/trunk/GtkJFileChooser/target/scala-2.10.1-RC1/classes:/home/andreas/Documents/Source/trunk/Core/lib/jsch-0.1.44.jar:/home/andreas/Documents/Source/trunk/Core/lib/org-netbeans-swing-outline.jar:/home/andreas/Documents/Source/trunk/Core/lib/jsch-0.1.48.jar:/home/andreas/Documents/Source/trunk/Core/lib/htmlparser-1.3.1.jar:/home/andreas/Documents/Source/trunk/Core/lib/tagsoup-1.2.1.jar:/home/andreas/Documents/Source/trunk/Core/lib/scala_2.10.0-RC2/scalaz-core_2.10-6.0.5-AW-sources.jar:/home/andreas/Documents/Source/trunk/Core/lib/scala_2.10.0-RC2/scalaz-core_2.10-6.0.5-AW.jar:/home/andreas/Documents/Source/trunk/Core/lib/scala_2.10.0-RC2/specs2_2.10.0-RC1-1.12.2.jar:/home/andreas/Documents/Source/trunk/Core/lib/scala_2.10.0-RC2/specs2-scalaz-core_2.10.0-RC1-6.0.1.jar:/home/andreas/Documents/Source/trunk/Core/lib/scala_2.10.0-RC2/scala-actors-2.10.0-RC2.jar:/home/andreas/Documents/Source/trunk/Core/lib/scala_2.10.0-RC2/reactive-core_2.10-0.1-SNAPSHOT.jar:/home/andreas/Documents/Source/trunk/Core/lib/sav/gtkjfilechooser.jar:/home/andreas/Documents/Source/trunk/Core/lib/sav/specs2_2.9.1-1.6.1.jar:/home/andreas/Documents/Source/trunk/Core/lib/sav/jsch-0.1.48.jar:/home/andreas/Documents/Source/trunk/Core/lib/sav/htmlparser-1.3.1.jar:/home/andreas/Documents/Source/trunk/Core/lib/sav/ftp4j-1.6.jar:/home/andreas/Documents/Source/trunk/Core/lib/sav/tagsoup-1.2.1.jar:/home/andreas/Documents/Source/trunk/Core/lib/scala_2.9.1/scalaz-core_2.9.1-6.0.3.jar:/home/andreas/Documents/Source/trunk/Core/lib/scala_2.9.1/specs_2.9.1-1.6.9.jar:/home/andreas/Documents/Source/trunk/Report/lib/freehep-graphicsio-emf-2.1.1.jar:/home/andreas/Documents/Source/trunk/Report/lib/freehep-graphicsio-swf-2.1.1.jar:/home/andreas/Documents/Source/trunk/Report/lib/freehep-graphicsio-ps-2.1.1.jar:/home/andreas/Documents/Source/trunk/Report/lib/freehep-io-2.0.2.jar:/home/andreas/Documents/Source/trunk/Report/lib/junit-3.8.2.jar:/home/andreas/Documents/Source/trunk/Report/lib/freehep-graphicsio-2.1.1.jar:/home/andreas/Documents/Source/trunk/Report/lib/freehep-graphicsio-pdf-2.1.1.jar:/home/andreas/Documents/Source/trunk/Report/lib/freehep-swing-2.0.3.jar:/home/andreas/Documents/Source/trunk/Report/lib/freehep-graphicsio-tests-2.1.1.jar:/home/andreas/Documents/Source/trunk/Report/lib/jas-plotter-2.2.jar:/home/andreas/Documents/Source/trunk/Report/lib/freehep-export-2.1.1-sources.jar:/home/andreas/Documents/Source/trunk/Report/lib/freehep-graphics2d-2.1.1.jar:/home/andreas/Documents/Source/trunk/Report/lib/freehep-xml-2.1.1.jar:/home/andreas/Documents/Source/trunk/Report/lib/jdom-1.0.jar:/home/andreas/Documents/Source/trunk/Report/lib/openide-lookup-1.9-patched-1.0.jar:/home/andreas/Documents/Source/trunk/Report/lib/freehep-graphicsio-svg-2.1.1.jar:/home/andreas/Documents/Source/trunk/Report/lib/freehep-export-2.1.1.jar:/home/andreas/Documents/Source/trunk/Report/lib/freehep-graphicsio-java-2.1.1.jar:/home/andreas/Documents/Source/trunk/Report/lib/freehep-util-2.0.2.jar:/home/andreas/Documents/Source/trunk/external/scalabeans/lib/scala-reflect-2.10.0-RC2.jar:/home/andreas/Documents/Source/trunk/external/scalabeans/lib/protostuff-xml-1.0.4.jar:/home/andreas/Documents/Source/trunk/external/scalabeans/lib/guava-r09.jar:/home/andreas/Documents/Source/trunk/external/scalabeans/lib/protostuff-json-1.0.4.jar:/home/andreas/Documents/Source/trunk/external/scalabeans/lib/jackson-core-asl-1.7.3.jar:/home/andreas/Documents/Source/trunk/external/scalabeans/lib/protostuff-api-1.0.4.jar:/home/andreas/Documents/Source/trunk/external/scalabeans/lib/protostuff-core-1.0.4.jar:/home/andreas/Documents/Source/trunk/external/scalabeans/lib/paranamer-2.3.jar
[error]
[error] last tree to typer: TypeTree(class PlateState)
[error] symbol: class PlateState in class PlateView (flags: )
[error] symbol definition: class PlateState extends ArrayView#ArrayState
[error] tpe: com.firefly.firecode.gui.PlateView#PlateState
[error] symbol owners: class PlateState -> class PlateView -> package gui
[error] context owners: constructor $anon$1 -> anonymous class $anon$1 -> method apply -> anonymous class $anonfun$apply$15 -> method apply -> anonymous class $anonfun$apply$14 -> method apply -> anonymous class 1 -> constructor Repls -> class Repls -> class PlateState -> class PlateView -> package gui
[error]
[error] == Enclosing template or block ==
[error]
[error] Apply( // val $outer(): com.firefly.firecode.gui.PlateView in class PlateState, tree.tpe=com.firefly.firecode.gui.PlateView
[error] $outer.com$firefly$firecode$gui$PlateView$PlateState$Repls$$anonfun$$anonfun$$$outer().com$firefly$firecode$gui$PlateView$PlateState$Repls$$anonfun$$$outer()."com$firefly$firecode$gui$PlateView$PlateState$$$outer" // val $outer(): com.firefly.firecode.gui.PlateView in class PlateState, tree.tpe=()com.firefly.firecode.gui.PlateView
[error] Nil
[error] )
[error]
[error] == Expanded type of tree ==
[error]
[error] TypeRef(
[error] pre = TypeRef(
[error] TypeSymbol(
[error] class PlateView extends ArrayView with Control with Observing with Menus
[error]
[error] )
[error] )
[error] TypeSymbol(class PlateState extends ArrayView#ArrayState)
[error] )
[error]
[error] no-symbol does not have an owner
[error] Total time: 210 s, completed Mar 5, 2013 6:25:21 PM

@scabug
Copy link
Author

@scabug scabug commented Mar 6, 2013

@retronym said:
Andreas: This error is the scalac internal equivalent of a NullPointerException. It is very likely that your issue is distinct.

Please open a new ticket. But we will need more data to reproduce it.

Firstly, run 'last' in SBT after the compilation crash to show me the full stack trace. That might be enough to see if this is an already-reported issue.

The problem was encountered in the file "PlateView.scala". Try to isolate to cut that file down step by step (replace method bodies by ???), to find which method contains the problematic construct. Then try to make another file with the same construct compile with the same construct but without dependencies on the rest of your project.

@scabug
Copy link
Author

@scabug scabug commented Mar 6, 2013

@retronym said (edited on Mar 6, 2013 6:16:28 AM UTC):
Thanks for the small test case.

Regressed in scala/scala@c800d1f, "Use context for buffering errors that cannot/shouldn't be reported in…"

@scabug
Copy link
Author

@scabug scabug commented Mar 6, 2013

@retronym said:
This is in Names/Defaults land; Lukas, could you please take a look?

@scabug
Copy link
Author

@scabug scabug commented Mar 6, 2013

@lrytz said:
yes

@scabug
Copy link
Author

@scabug scabug commented Mar 6, 2013

@lrytz said:
reduced the crashing example:

object MessageType {
  val HELLO = ""
}

class Message(messageType: String, reason: Option[String])

class ReproForSI6921 {

  private[this] var reason = ""

  def decideElection {
    val explanation = None
    new Message(MessageType.HELLO, reason = explanation)
  }
}
no-symbol does not have an owner
	at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:49)
	at scala.tools.nsc.Global.abort(Global.scala:254)
	at scala.reflect.internal.Symbols$NoSymbol.owner(Symbols.scala:3248)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.hostForAccessorOf(SuperAccessors.scala:548)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.needsProtectedAccessor(SuperAccessors.scala:524)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.mayNeedProtectedAccessor$1(SuperAccessors.scala:162)

by reducing it further to the following, the compiler no longer crashes but gives a very strange error message that i haven't seen before:

class Message(messageType: String, reason: Option[String])

class ReproForSI6921 {

  private[this] var reason = ""

  def decideElection = {
    val explanation = None
    new Message("", reason = explanation)
  }
}
sandbox/t6921-2.scala:7: error: erroneous or inaccessible type
  def decideElection = {
      ^
one error found

@scabug
Copy link
Author

@scabug scabug commented Mar 6, 2013

@scabug
Copy link
Author

@scabug scabug commented Mar 6, 2013

Andreas W (andreasw) said:
Thanks, Jason, I will see what I can do. That class has a lot of inheritance of inner classes and traits from other files and packages, though, it will not be easy to reduce it.

My first priority will be to get working again, which means rolling back the IDE to 2.10.0, somehow. With SBT, changing the Scala version to 2.10.0-RC2 fixes the problem.

@scabug
Copy link
Author

@scabug scabug commented Mar 6, 2013

Andreas W (andreasw) said:
I have attached the output of "sbt> last". Hope it helps. I will attempt the isolation, but I can't spend more than a couple of hours on it, so can't guarantee success.

@scabug
Copy link
Author

@scabug scabug commented Mar 6, 2013

Andreas W (andreasw) said:
As requested, I have opened a new issue: #7223

@scabug
Copy link
Author

@scabug scabug commented Mar 13, 2013

@retronym said:
Lukas: I can make the problem go away with a duplicate. https://github.com/retronym/scala/compare/ticket/7239

What are the downsides of this? Can this introduce other problems?

@scabug
Copy link
Author

@scabug scabug commented Mar 13, 2013

@lrytz said:
I guess the downside is that it's a bit of a band-aid solution that has to be applied in many places - we know what we should do instead (make typed non-destructive), but that's more involved. Other than that duplicating is what I would have done as well, I don't think there are any problems with it.

@scabug
Copy link
Author

@scabug scabug commented Mar 13, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants