title: Scala match error
body: <p>I tried to replace my isInstanceOf check with a match, but it does not work.</p>
  
  <p>In my method I do a check for a tree node - if it is a leaf - I want to return it inside a Vector right away, if not - I continue with the method.</p>
  
  <p>So originally I had:</p>
  
  <pre><code>    //code here
      if (common.isInstanceOf[LeafNode]) {
          return Vector(common.asInstanceOf[LeafNode].data)
      }
      //code here
  </code></pre>
  
  <p>then I tried to replace it with:</p>
  
  <pre><code>    //code here
       common match {
          case leaf: LeafNode =&gt; return Vector(leaf.data)
      }
      //code here
  </code></pre>
  
  <p>but I get scala.MatchError.</p>