Here is an example. The "pasted" class is loaded by the REPL's class loader, so you can supply it explicitly. You can also use tb.eval
.
$ scala
Welcome to Scala version 2.11.7 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_60).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import reflect.runtime._,universe._,tools.reflect.ToolBox
import reflect.runtime._
import universe._
import tools.reflect.ToolBox
scala> :pa -raw
// Entering paste mode (ctrl-D to finish)
package p { class Parent(val i: Int) }
// Exiting paste mode, now interpreting.
scala> val tb = runtimeMirror($intp.classLoader).mkToolBox()
tb: scala.tools.reflect.ToolBox[reflect.runtime.universe.type] = scala.tools.reflect.ToolBoxFactory$ToolBoxImpl@5e316c74
scala> tb.compile(tb.parse("""case class Child(j: Int) extends p.Parent(42) ; val c = Child(17) ; c.j"""))()
res0: Any = 17
scala> val tb = currentMirror.mkToolBox()
tb: scala.tools.reflect.ToolBox[reflect.runtime.universe.type] = scala.tools.reflect.ToolBoxFactory$ToolBoxImpl@59a67c3a
scala> tb.compile(tb.parse("""case class Child(j: Int) extends p.Parent(42) ; val c = Child(17) ; c.j"""))()
res1: Any = 17
There is surely an example in the docs somewhere or on this site.