title: How recursion in scala tree((sealed trait)
body: <p>when I programming task in scala I crashed the problem</p>
  <p>the error code is missing parameter type for expanded function.</p>
  <p>Expected type was: Int
  def sum_tree(t : Tree[Int]): int ={</p>
  <pre><code>sealed trait Tree[Int]
  case class Leaf[Int](elem: Int) extends Tree[Int]
  case class Node[Int](elem: Int, left: Tree[Int], right: Tree[Int]) extends Tree[Int]
  val tree = Node(7, Node(3, Leaf(1), Leaf(2)), Leaf(4))
  
  def sum_tree(t : Tree[Int]): Int = {
    //must use recursion call function.
    case Leaf(elem) =&gt; elem
    case Node(elem, l, r) =&gt; elem + sum_tree(l) + sum_tree( l )
    case None =&gt; 0
  }
  println(&quot;** p6 **&quot;)
  println(sum_tree(tree)
  </code></pre>