title: Getting method's function type from the MethodMirror instance in Scala
body: <p>Assume I have an instance of <code>MethodMirror</code> created for a certain method of an object. By mirror's fields I can easily access return type and parameters of the method. But I actually need to obtain the type this method would have as a function.</p>
  
  <p>Here is a toy code example which will help me explain, what I want to achieve. I'm using Scala 2.11.6.</p>
  
  <pre><code>import scala.reflect.runtime.universe._
  
  object ForStackOverflow {
    object Obj {
      def method(x:String, y:String):Int = 0
      def expectedRetType():((String, String) =&gt; Int) = ???
    }
  
    def main(args: Array[String]) {
      val mirror:Mirror = runtimeMirror(getClass.getClassLoader)
      val instanceMirror = mirror.reflect(Obj)
  
      val methodSymbol:MethodSymbol = instanceMirror.symbol.toType.decl(TermName("method")).asMethod
      val methodMirror = instanceMirror.reflectMethod(methodSymbol)
  
      println(methodMirror.symbol.returnType)
      println(methodMirror.symbol.paramLists(0).map { x =&gt; x.info.resultType }.mkString(", "))
  
      val expectedSymbol:MethodSymbol = instanceMirror.symbol.toType.decl(TermName("expectedRetType")).asMethod
      println("I would like to produce from a 'methodMirror' this: "+expectedSymbol.returnType)
    }
  }
  </code></pre>
  
  <p>I want to produce <code>Type</code> instance from the <code>methodMirror</code> which would represent a function. For this example it should be <code>(String, String) =&gt; Int</code>. I would prefer a solution that doesn't depend too much on the concrete Scala's <code>FunctionX</code> classes.</p>