title: Scala pattern matching throws match error when returned null in tuple
body: <p>Below are two snippets , i am unable to understand why one executes successfully and the other throws the run time exception.</p>
  
  <p>Snippet1 :</p>
  
  <pre><code>val str = "HELP"
  
  val perfectTuple: (String, String) = str match {
      case "NO-HELP" =&gt; ("First Help", "Second Help")
      case "OTHER-HELP" =&gt; ("I won't Help!", "Even,I won't Help!")
      case "HELP" =&gt; (null,"Single Help")
      case _ =&gt; throw new NoSuchMethodException
  
    }
  </code></pre>
  
  <p>Snippet2:</p>
  
  <pre><code>val str = "HELP"
  
  val (firstPart:String, secondPart:String) = str match {
    case "NO-HELP" =&gt; ("First Help", "Second Help")
    case "OTHER-HELP" =&gt; ("I won't Help!", "Even,I won't Help!")
    case "HELP" =&gt; (null,"Single Help")
    case _ =&gt; throw new NoSuchMethodException
  }
  </code></pre>
  
  <p>==========================</p>
  
  <p>There is a very little difference between the two snippets. One stores the returned tuple into a value 'perfectTuple' of type tuple2 and this one gets executed successfully.</p>
  
  <p>Other one extract the values out of the tuple 2 and stores them into the string values and throws a run time 'scala.matchError'.</p>
  
  <p>Is this a bug in scala?</p>
  
  <p>I have tried this on scala 2.10.5 and 2.11.7</p>
  
  <p>Thanks in advance.</p>
  
  <p>=============</p>
  
  <p>one more scenario, in which i can assign null to a string from pattern matching and this one works absolutely perfect:
  Snippet3:</p>
  
  <pre><code>val str = "HELP"
  
  val assignNullToString: String = str match {
  
      case "NO-HELP" =&gt; "ONE"
      case "OTHER-HELP" =&gt; "TWO"
      case "HELP" =&gt; null
      case _ =&gt; throw new NoSuchMethodException
  }          
  </code></pre>
  
  <p>So i assume, its not that i am assigning null to a String is causing a problem, its something to do with Tuple ? and what is the problem with Snippet 2 , whereas Snippet 1 is running absolutely fine.</p>