summaryrefslogtreecommitdiff
path: root/test/pending/run/reify_closure4b.scala
blob: 9eeb01b459415c847850556698fc27eb257159d4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
object Test extends App {
  def foo(y: Int): Int => Int = {
    class Foo(y: Int) {
      val 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))
}