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




                                 
                                                  
              
        

     
                             
                                                  





                                
object Test extends App {
  def foo(y: Int): Int => Int = {
    class Foo(y: Int) {
      def y1 = y

      val fun = reflect.mirror.reify{(x: Int) => {
        x + y1
      }}
    }

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

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