title: How can I get Scala ToolBox to see REPL definitions?
body: <p>Back when reflection was still incipient, on the days of Scala 2.10.0 milestones, I <a href="https://stackoverflow.com/q/11055210/53013">asked a question</a> about how could I use it to see the trees of code snippets from REPL. The excellent answer went further than I asked, and showed how they can be used to parse and evaluate trees as well, so I went ahead and tried to use that on a little project I had going on today.</p>
  
  <p>Unfortunately, code parsed and evaluated that way doesn't seem to see any REPL definition:</p>
  
  <pre><code>scala&gt; val x = 1
  x: Int = 1
  
  scala&gt; import scala.tools.reflect.ToolBox
  import scala.tools.reflect.ToolBox
  
  scala&gt; val tb = scala.reflect.runtime.universe.runtimeMirror(
    getClass.getClassLoader).mkToolBox()
  tb: scala.tools.reflect.ToolBox[reflect.runtime.universe.type] = ...
  
  scala&gt; tb.eval(tb.parse("x"))
  scala.tools.reflect.ToolBoxError: reflective compilation has failed:
  
  not found: value x
  </code></pre>
  
  <p>Is there a way to get it to recognize definitions made on REPL?</p>