Missing type parameter for expanded function
<p>I'm learning Scala and the following simple program got me stuck:</p>

<pre><code>class ObjectPrinter[T &lt;: AnyVal](x: T) {
  def print(t: T) = { // &lt;--- error here
    case Is(i) =&gt; println("Integer: " + i)
    case Ds(d) =&gt; println("Double: " + d)
    case _ =&gt; println("Default")
  }

  case class Is(i : Int) extends ObjectPrinter[Int](i);
  case class Ds(d: Double) extends ObjectPrinter[Double](d);
}
</code></pre>

<p>The error message is the following:</p>

<blockquote>
  <p>Missing type parameter for expanded function. The argument type of an
  anonymous function must be fully known. Expected type was: ?</p>
</blockquote>

<p>The message is completely unclear to me. What do they mean, missing type parameter? I thought the type parameter follows after the <code>case</code>, like <code>Is(i)</code>. What function is expanded?</p>

<p><strong><em>UPD:</em></strong> I want to return a function depending on the type of the argument passed in as a parameter.</p>