title: Scala: compilation error when declaring continuation of type Any => Nothing
body: <p>This code gives compilation error:</p>
  
  <pre><code>import scala.util.continuations._
  
  object CTest {
      def loop: Nothing = reset {
          shift {c: (Unit =&gt; Nothing) =&gt; c()}
          loop
      }
  
     def main(argv: Array[String]) {loop}
  }
  </code></pre>
  
  <p>Error message:</p>
  
  <pre><code>    error: type mismatch;
   found   : ((Unit) =&gt; Nothing) =&gt; (Unit) =&gt; Nothing
   required: ((Unit) =&gt; B) =&gt; (Unit) =&gt; Nothing
  </code></pre>
  
  <p>But this code works as expected:</p>
  
  <pre><code>import scala.util.continuations._
  
  object CTest {
      def loop: Nothing = reset {
          shift {c: (Unit =&gt; Any) =&gt; c.asInstanceOf[Unit =&gt; Nothing]()}
          loop
      }
  
     def main(argv: Array[String]) {loop}
  }
  </code></pre>
  
  <p>The question is: why Scala compiler hates <s>me</s> continuations of type Any => Nothing?</p>