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

java.lang.Error: no-symbol does not have owner with CPS-Plugin #3501

Closed
scabug opened this issue May 28, 2010 · 9 comments
Closed

java.lang.Error: no-symbol does not have owner with CPS-Plugin #3501

scabug opened this issue May 28, 2010 · 9 comments
Assignees

Comments

@scabug
Copy link

scabug commented May 28, 2010

The following code raises the error:

java.lang.Error: no-symbol does not have owner
        at scala.tools.nsc.symtab.SymbolTable.abort(SymbolTable.scala:33)
        at scala.tools.nsc.symtab.Symbols$$NoSymbol$$.owner(Symbols.scala:2048)
        at
scala.tools.nsc.transform.ExplicitOuter$$OuterPathTransformer.outerSelect(ExplicitOuter.scala:190)
        at
scala.tools.nsc.transform.ExplicitOuter$$OuterPathTransformer.outerPath(ExplicitOuter.scala:217)
        at
scala.tools.nsc.transform.ExplicitOuter$$ExplicitOuterTransformer.transform(ExplicitOuter.scala:456)
        at
scala.tools.nsc.ast.Trees$$Transformer$$$$anonfun$$transform$$4.apply(Trees.scala:736)
        at
scala.tools.nsc.ast.Trees$$Transformer$$$$anonfun$$transform$$4.apply(Trees.scala:735)
        at scala.tools.nsc.ast.Trees$$Transformer.atOwner(Trees.scala:856)
        at
scala.tools.nsc.transform.TypingTransformers$$TypingTransformer.atOwner(TypingTransformers.scala:35)
        at
scala.tools.nsc.transform.TypingTransformers$$TypingTransformer.atOwner(TypingTransformers.scala:28)
        at scala.tools.nsc.ast.Trees$$Transformer.transform(Trees.scala:734) 
package test
import scala.util.continuations._
object NoSymbolTest {
   
  def sum(a: Int, b: Int): Int = a + b
 
  def main(args: Array[String]) = {
       
    def capture(): Int @suspendable =
      shift { k: (Int => Unit) => {
        k(42)
def loop(): Unit @suspendable = {
  var x = 0
  while (x < 3) {
    val y = capture()

// val s = sum(x, y) // java.lang.Error: no-symbol does not have owner
// x = s
x = sum(x,y) // WORKS
}
println("x: " + x)
}

reset[Unit,Unit] {
  loop()
}

}
}
{code}

@scabug
Copy link
Author

scabug commented May 28, 2010

Imported From: https://issues.scala-lang.org/browse/SI-3501?orig=1
Reporter: Kai Meder (hotzen)
Attachments:

  • t3501.patch (created on Aug 4, 2011 12:53:37 AM UTC, 2306 bytes)

@scabug
Copy link
Author

scabug commented Jun 15, 2010

@TiarkRompf said:
reducing it further:

import scala.util.continuations._

object Test {

  def capture(): Int @suspendable = 42

  def loop(): Unit @suspendable = {
    while (true) {
      val y = foo()
      val s = y // java.lang.Error: no-symbol does not have owner
    }
    // removing either 'val s = ' or replacing 'y' with
    // something else will make it work
  } 
}

@scabug
Copy link
Author

scabug commented Jun 15, 2010

@TiarkRompf said:
capture=foo. problem seems to be specific to right-hand sides of ValDefs within while loops. a possible workaround is to declare a var outside the loop and assign to that var within the loop.

@scabug
Copy link
Author

scabug commented Oct 10, 2010

@TiarkRompf said:
See #3891 for another manifestation of this issue.

@scabug
Copy link
Author

scabug commented Oct 19, 2010

@paulp said:
Tiark -- in case it should be useful, I call your attention to the recently rendered usable tree checker output. It is displeased that val tmp1's owner is not who it expects.

% scalac  -Ycheck-debug -Ycheck:all  -P:continuations:enable a.scala  
Created [REF(type AnyRef)]
[Not checkable: parser]
[Not checkable: namer]
[Not checkable: packageobjects]
[Now checking: typer]
[check: typer] 19 new symbols.
unhandled impoprt: import scala.util.continuations._ in a.scala
[Now checking: superaccessors]
unhandled impoprt: import scala.util.continuations._ in a.scala
[Now checking: pickler]
unhandled impoprt: import scala.util.continuations._ in a.scala
[Now checking: refchecks]
[Now checking: selectiveanf]
[check: selectiveanf] 4 new symbols.
[check: selectiveanf] a.scala:8: Expected owner method while$$1, found method loop: scala.reflect.generic.Trees$$ValDef / @scala.util.continuations.cpsSym <synthetic> val tmp1: Unit = {
  @scala.util.continuations.cpsSym val y: Int = Test.this.capture();
  val s: Int = y;
  ()
}
[Now checking: liftcode]
[check: liftcode] a.scala:8: Expected owner method while$$1, found method loop: scala.reflect.generic.Trees$$ValDef / @scala.util.continuations.cpsSym <synthetic> val tmp1: Unit = {
  @scala.util.continuations.cpsSym val y: Int = Test.this.capture();
  val s: Int = y;
  ()
}
[Now checking: selectivecps]
[check: selectivecps] 12 new symbols.
[check: selectivecps] a.scala:10: Expected owner method while$$1, found method loop: scala.reflect.generic.Trees$$ValDef / val s: Int = y
[...]

@scabug
Copy link
Author

scabug commented May 27, 2011

@ingoem said:
In probably doesn't give any new insight, but I hit this issue with the following snippet:

def f(): String @suspendable = ""
reset { 
  while(true) { 
    val p = f.length // assignment and member access both critical
  }
}

@scabug
Copy link
Author

scabug commented Aug 4, 2011

Topher (topher.the.geek) said:
I've attached a patch, including a test case.

@scabug
Copy link
Author

scabug commented Aug 4, 2011

Topher (topher.the.geek) said:
Oh, the patch adds files, so you'll want to do:

patch -p0 -i ~/tmp/t3501.patch
svn add test/files/continuations-run/t3501.check test/files/continuations-run/t3501.scala

@scabug
Copy link
Author

scabug commented Aug 23, 2011

Commit Message Bot (anonymous) said:
(rompf in r25544) applying patch provided by Topher, fixes #3501. no review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants