summaryrefslogblamecommitdiff
path: root/test/files/run/reify_closure2a.scala
blob: f5669a0e2c35cd5749224aff5044f996568af734 (plain) (tree)
1
2
3
4
5
6
7
8
9
                             


                                 
                                 
           
      
 
                             
                                       





                                
import scala.reflect.mirror._

object Test extends App {
  def foo(y: Int): Int => Int = {
    val fun = reify{(x: Int) => {
      x + y
    }}

    val toolbox = mkToolBox()
    val dyn = toolbox.runExpr(fun.tree)
    dyn.asInstanceOf[Int => Int]
  }

  println(foo(1)(10))
  println(foo(2)(10))
}