title: Scala inferred type arguments - Type bounds inferring to 'Nothing'
body: <p>I'm attempting to write a simple query monad and am having trouble getting my <em>generic</em> type annotations correct.</p>
  
  <p>My first attempt went as follows (vastly simplified for conciseness)</p>
  
  <pre><code>case class Person( val name: String )
  abstract class Schema[T]    
  object People extends Schema[Person]
  
  case class Query[U &lt;: Schema[T], T]( schema: U ) {      &lt;---- Type signature
      def results: Seq[T] = ...
      def where( f: U =&gt; Operation ) = ...
  }
  
  class TypeText extends Application {
      val query = Query( People )                     &lt;---- Type inference fails
  }
  </code></pre>
  
  <p>The compiler didn't like this, as it couldn't infer the type of 'T'.</p>
  
  <blockquote>
    <p>error: inferred type arguments [People.type,Nothing] do not conform to method apply's type parameter bounds [U &lt;: Schema[T],T]</p>
  </blockquote>
  
  <p>While experimenting I found that using view bounds instead works as expected</p>
  
  <pre><code>case class Query[U &lt;% Schema[T], T]( schema: U ) {
  </code></pre>
  
  <p>(Note the use of view bound "&lt;%" instead of type bound "&lt;:")</p>
  
  <p>However in my limited understanding of the type system, since I'm expecting an actual subclass (and not just convertibility) of Schema[T], I would assume type bound "&lt;:" is the correct bounds to be using here?</p>
  
  <p>If this is the case, what am I missing - how do I give the compiler enough hints to infer T correctly when using type bounds instead of view bounds?</p>