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

toolbox compiler fails to capture free local vars #7558

Closed
scabug opened this issue Jun 5, 2013 · 2 comments
Closed

toolbox compiler fails to capture free local vars #7558

scabug opened this issue Jun 5, 2013 · 2 comments
Assignees
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Jun 5, 2013

scala-hash v2.10.2-RC2 -nc # same with 2.11.0-M3
[info] v2.10.2-RC => /Users/jason/usr/scala-v2.10.2-RC2-0-g60d462e
Welcome to Scala version 2.10.2-20130530-074427-60d462ef6e (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_37).
Type in expressions to have them evaluated.
Type :help for more information.

scala> val cm = reflect.runtime.currentMirror; val u = cm.universe; import scala.tools.reflect.ToolBox; val tb = cm.mkToolBox()
cm: reflect.runtime.universe.Mirror = JavaMirror with scala.tools.nsc.interpreter.IMain$TranslatingClassLoader@78c0dc2 of type class scala.tools.nsc.interpreter.IMain$TranslatingClassLoader with classpath [(memory)] and parent being scala.tools.nsc.util.ScalaClassLoader$URLClassLoader@7bdb3f6c of type class scala.tools.nsc.util.ScalaClassLoader$URLClassLoader with classpath [file:/Library/Java/JavaVirtualMachines/1.6.0_37-b06-434.jdk/Contents/Classes/classes.jar,file:/Library/Java/JavaVirtualMachines/1.6.0_37-b06-434.jdk/Contents/Classes/ui.jar,file:/Library/Java/JavaVirtualMachines/1.6.0_37-b06-434.jdk/Contents/Classes/jsse.jar,file:/Library/Java/JavaVirtualMachines/1.6.0_37-b06-434.jdk/Contents/Classes/jce.jar,file:/Library/Java/JavaVirtualMachines/1.6.0_37-b06-434.jdk/Contents/Classe...
scala> var t = { var x = "ab".toList; u.reify { x = x.reverse; x }.tree }
t: u.Tree =
{
  x.elem = x.elem.reverse;
  x.elem
}

scala> tb.eval(t)
scala.tools.reflect.ToolBoxError: reflective compilation has failed:

value reverse is not a member of <notype>
type mismatch;
 found   : <notype>
 required: Any
Note that <none> extends Any, not AnyRef.
Such types can participate in value classes, but instances
cannot appear in singleton types or in reference comparisons.
	at scala.tools.reflect.ToolBoxFactory$ToolBoxImpl$ToolBoxGlobal.throwIfErrors(ToolBoxFactory.scala:311)

I have a patch for this.

@scabug
Copy link
Author

@scabug scabug commented Jun 5, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7558?orig=1
Reporter: @retronym
Affected Versions: 2.10.0

@scabug
Copy link
Author

@scabug scabug commented Jun 5, 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