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

toolboxes don't support typed trees #5748

Open
scabug opened this issue May 3, 2012 · 2 comments

Comments

@scabug
Copy link

commented May 3, 2012

import scala.reflect.mirror._

object Test extends App {
  val code = reify {
    class C {
      val x = 2
    }

    println(new C().x)
  };

  val toolbox = mkToolBox()
  val ttree = toolbox.typeCheck(code.tree)
  toolbox.runExpr(ttree)
}
scala.reflect.runtime.ToolBoxes$ToolBox$ToolBoxError: reflective toolbox has failed: cannot operate on trees that are already typed
        at scala.reflect.runtime.ToolBoxes$ToolBox$ToolBoxGlobal.verifyExpr(ToolBoxes.scala:49)
        at scala.reflect.runtime.ToolBoxes$ToolBox$ToolBoxGlobal.compileExpr(ToolBoxes.scala:131)
        at scala.reflect.runtime.ToolBoxes$ToolBox$ToolBoxGlobal.runExpr(ToolBoxes.scala:227)
        at scala.reflect.runtime.ToolBoxes$ToolBox.runExpr(ToolBoxes.scala:344)
        at Test$delayedInit$body.apply(t5230.scala:14)
        at scala.Function0$class.apply$mcV$sp(Function0.scala:40)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App$$anonfun$main$1.apply(App.scala:61)
        at scala.App$$anonfun$main$1.apply(App.scala:61)
        at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
        at scala.collection.immutable.List.foreach(List.scala:77)
        at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:31)
        at scala.collection.mutable.ListBuffer.foreach(ListBuffer.scala:45)
        at scala.App$class.main(App.scala:61)
        at Test$.main(t5230.scala:3)
        at Test.main(t5230.scala)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at scala.tools.nsc.util.ScalaClassLoader$$anonfun$run$1.apply(ScalaClassLoader.scala:92)
        at scala.tools.nsc.util.ScalaClassLoader$class.asContext(ScalaClassLoader.scala:40)
        at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.asContext(ScalaClassLoader.scala:161)
        at scala.tools.nsc.util.ScalaClassLoader$class.run(ScalaClassLoader.scala:92)
        at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.run(ScalaClassLoader.scala:161)
        at scala.tools.nsc.CommonRunner$class.run(ObjectRunner.scala:28)
        at scala.tools.nsc.ObjectRunner$.run(ObjectRunner.scala:45)
        at scala.tools.nsc.CommonRunner$class.runAndCatch(ObjectRunner.scala:35)
        at scala.tools.nsc.ObjectRunner$.runAndCatch(ObjectRunner.scala:45)
        at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:70)
        at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:92)
        at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:101)
        at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
@scabug

This comment has been minimized.

Copy link
Author

commented May 3, 2012

Imported From: https://issues.scala-lang.org/browse/SI-5748?orig=1
Reporter: @xeno-by
Affected Versions: 2.10.0-M3

@scabug

This comment has been minimized.

Copy link
Author

commented Sep 17, 2012

@xeno-by said:
Martin suggested we introduce runTypedExpr, so that local definitions don't conflict with the Namer (because currently runExpr starts the compiler from the Namer phase)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.