title: What is the type of this function in Scala?
body: <p>What function type should I specify instead <code>AnyRef</code>?</p>
  
  <pre><code>case class Fun() {
    val anonFun: AnyRef = { 
      (x: Int) =&gt; x + 1
    }
  }
  </code></pre>
  
  <p>My calling code:</p>
  
  <pre><code>val f = Fun()
  val result = f.anonFun(1)
  </code></pre>
  
  <p><strong>PS</strong></p>
  
  <p>As @jarandaf said the return type of this specific function is <code>Function1[Int, Int]</code>. But who can explain me why not <code>Function1[Int]</code>?</p>