summaryrefslogblamecommitdiff
path: root/test/pending/run/reify_closure2b.scala
blob: f9ed16d309bda03480d9d5c3ef956b171db12c8e (plain) (tree)
1
2
3
4
5
6
7
8
9


                                 
                                                  
             
        

     
                             
                                                  





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

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

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