title: scala: a type was inferred to be `Any`; this may indicate a programming error
body: <pre><code>    val postFutureOption = postDAO.find(postId)
      val tagFutureOption = tagDAO.find(tagId)
      val tupleFutures = for{
        postOption &lt;- postFutureOption
        tagOption &lt;- tagFutureOption
      }yield(postOption, tagOption)
  
      tupleFutures.flatMap{tuple =&gt;
        tuple match{
          case (Some(post),Some(tag)) =&gt; {
            def addPostTag(post: Post, tag: models.Tag): Future[Option[Post]] = {
              if(post.tags.map(_.tagId).contains(tagId)){
                Future.successful(Some(post))
              }else {
                postDAO.addTag(postId, tagId).map{_ =&gt; Some(post.copy(tags = post.tags :+ tag))}
              }
            }
            addPostTag(post, tag)
          }
          case _ =&gt; Future.successful(None)
        }
      }
    }
  </code></pre>
  
  <p>This code has fatal warning</p>
  
  <pre><code>a type was inferred to be `Any`; this may indicate a programming error.
  
      [error]           def addPostTag(post: Post, tag: models.Tag): Future[Option[Post]] = {
      [error]               ^
  </code></pre>
  
  <p>I don't really get what is the issue about: <a href="https://issues.scala-lang.org/browse/SI-9211" rel="nofollow">https://issues.scala-lang.org/browse/SI-9211</a>
  So please, advice if I can fix my code, or I need a workaround for the scala issue?</p>
  
  <p>=====================</p>
  
  <p>More  experiments:</p>
  
  <pre><code>tuple match{
          case (Some(post), Some(tag)) =&gt; {
            Future.successful(Some(post))
          }
          case _ =&gt; Future.successful(None)
        }
  </code></pre>
  
  <p>Compiles OK, but</p>
  
  <pre><code>tuple match{
          case (Some(post), Some(tag)) =&gt; {
            if(post.tags.map(_.tagId).contains(tagId)){
              Future.successful(Some(post))
            }else {
              postDAO.addTag(postId, tagId).map{_ =&gt; Some(post.copy(tags = post.tags :+ tag))}
            }
            Future.successful(Some(post))
          }
          case _ =&gt; Future.successful(None)
        }
  </code></pre>
  
  <p>Has the warning....</p>
  
  <pre><code>[error]         case (Some(post), Some(tag)) =&gt; {
  [error]                                         ^
  </code></pre>