title: How is compare different from compareTo in this Scala code?
body: <p>I have a piece of code that I use to provide an implicit ordering for a priority queue:</p>
  
  <pre><code>type Time = Int
  type Item = (Time, Whatever)
  
  implicit def order(thisItem: Item): Ordered[Item] =
      new Ordered[Item] {
        override def compare(thatItem: Item) = {
          val result = thisItem._1 compareTo thatItem._1
          -result
        }
      }
  </code></pre>
  
  <p>Now this code doesn't compile on Scala 2.7 - the error message is:</p>
  
  <pre><code>error: type mismatch;
   found   : SimulationMode.this.Time
   required: ?{val compareTo: ?}
  Note that implicit conversions are not applicable because they are ambiguous:
   both method int2Integer in object Predef of type (Int)java.lang.Integer
   and method intWrapper in object Predef of type (Int)scala.runtime.RichInt
   are possible conversion functions from SimulationMode.this.Time to ?{val compareTo: ?}
          val result = thisItem._1 compareTo thatItem._1
                                ^
  </code></pre>
  
  <p>I found two ways to make it compile - either declare the type of <strong><em>result</em></strong> to be <strong><em>Int</em></strong> or change the use of <strong><em>compareTo</em></strong> to <strong><em>compare</em></strong>. But my question is - is there a reason for such an error, what does the message mean and is this a bug in the scala compiler? compareTo just calls compare in the Ordered[A] trait and has the same signature... Plus both of them return Int, so why does it matter that I declare the type myself?</p>