title: Scala generics: Int not conforming to Comparable?
body: <p>The following Scala declarations are OK:</p>
  
  <pre><code>trait Base[B &lt;: Base[B,M,ID], M &lt;: Meta[B,M,ID], ID &lt;: Comparable[ID]] {
      // ...
  }
  
  trait Meta[B &lt;: Base[B,M,ID], M &lt;: Meta[B,M,ID], ID &lt;: Comparable[ID]] extends Ordered[Meta[_,_,_]] {
      // ...
  }
  
  trait BaseWithID[B &lt;: BaseWithID[B,M,ID], M &lt;: Meta[B,M,ID], ID &lt;: Comparable[ID]] extends Base[B,M,ID] with Ordered[B] {
      // ...
  }
  
  
  trait BaseWithIntID[B &lt;: BaseWithIntID[B,M,ID], M &lt;: MetaWithIntID[B,M,ID], ID &lt;: Comparable[ID]] extends BaseWithID[B,M,ID] {
      // ...
  }
  
  trait MetaWithIntID[B &lt;: BaseWithIntID[B,M,ID], M &lt;: MetaWithIntID[B,M,ID], ID &lt;: Comparable[ID]] extends Meta[B,M,ID] {
      // ...
  }
  </code></pre>
  
  <p>But the following two are not:</p>
  
  <pre><code>trait BaseWithIntID[B &lt;: BaseWithIntID[B,M], M &lt;: MetaWithIntID[B,M]] extends BaseWithID[B,M,Int] {
      // ...
  }
  
  trait MetaWithIntID[B &lt;: BaseWithIntID[B,M], M &lt;: MetaWithIntID[B,M]] extends Meta[B,M,Int] {
      // ...
  }
  </code></pre>
  
  <p>The difference is that I removed the ID type parameter in BaseWithIntID and MetaWithIntID, and specified Int explicitly in their respective base traits. But this does not compile, so does that mean that Int is not Comparable in Scala? If it is, what am I doing wrong? I tried Ordered instead of Comparable, and it made not difference.</p>
  
  <p>I'm using Eclipse, and as usual, the error messages are unhelpful:</p>
  
  <pre><code>type arguments [B,M,Int] do not conform to trait BaseWithID's type parameter bounds [B &lt;: BaseWithID[B,M,ID],M &lt;: Meta[B,M,ID],ID &lt;: java.lang.Comparable[ID]]
  </code></pre>
  
  <p>It just says that something is wrong, but not which type parameter is wrong, and why. Looking at <a href="https://stackoverflow.com/questions/4113357/why-does-the-type-parameter-bound-t-comparablet-fail-for-t-int">this question</a>, I thought I could try "ID &lt;% Comparable[ID]" instead, but that is not legal in a trait declaration.</p>
  
  <p>Actually, this does not work either (with the same error message):</p>
  
  <pre><code>trait TestBase extends BaseWithID[TestBase,TestMeta,Int]
  
  trait TestMeta extends Meta[TestBase,TestMeta,Int]
  </code></pre>