Scala Programming Language
  1. Scala Programming Language
  2. SI-6181

method mirrors don't like by-name arguments

    Details

      Description

      import scala.reflect.runtime.universe._
      import scala.reflect.runtime.{currentMirror => cm}
      
      object Test extends App {
        class C { def test(x: => Int) = println(x) }
        val mm = cm.reflect(new C).reflectMethod(typeOf[C].member(newTermName("test")).asMethod)
        try mm(2) catch { case ex: Throwable => println(ex.getClass + ": " + ex.getMessage) }
        mm(() => 2)
      }
      
      class java.lang.IllegalArgumentException: argument type mismatch
      2
      

        Activity

        Show
        Eugene Burmako added a comment - https://github.com/scala/scala/commit/3c4f4865f6420f98a7ed502257bc65387951e26c

          People

          • Assignee:
            Eugene Burmako
            Reporter:
            Eugene Burmako
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development