title: Why do I need an explicit type argument list here?
body: <p>I am writing a generic FSM library:</p>
  
  <pre><code>import scala.annotation.tailrec
  
  trait State {
    def isAcceptState: Boolean
  }
  
  trait FSM[T &lt;: FSM[T, A, S], -A, +S &lt;: State] { this: T =&gt;
    def state: S
  
    def resume(input: A): T
  }
  
  object FSM {
    @tailrec
    def resumeUntilAccept[T &lt;: FSM[T, A, S], A, S &lt;: State](fsm: T, inputs: Iterator[A]): T = {
      if (inputs.hasNext) {
        val input = inputs.next
        val newFSM = fsm.resume(input)
        if (newFSM.state.isAcceptState) {
          newFSM
        } else {
          resumeUntilAccept[T, A, S](newFSM, inputs) // THIS LINE OF CODE
        }
      } else {
        throw new Exception("not enough inputs")
      }
    }
  }
  </code></pre>
  
  <p>If I remove the type argument list on the line marked <code>// THIS LINE OF CODE</code>, I get the following error:</p>
  
  <blockquote>
    <p>Main.scala:22: error: inferred type arguments <code>[T,A,Nothing]</code> do not conform to method <code>resumeUntilAccept</code>'s type parameter bounds <code>[T &lt;: FSM[T,A,S],A,S &lt;: State]</code></p>
  
  <pre><code>   resumeUntilAccept(newFSM, inputs)
     ^
  </code></pre>
  </blockquote>
  
  <p>Why is <code>Nothing</code> inferred instead of <code>S</code>? And even then, why does it not conform? <code>Nothing</code> is clearly a subtype of <code>State</code>.</p>