Aladdin - Scala Bugtracking
[#330] project: compiler priority: low category: bug
submitter assigned to status date submitted
Burak Martin fixed 2004-05-10 12:33:36.0
subject view resolution too weak
code
/** Address holds a path in Dewey notation
*/
case class Address( list:List[Int] ) with Ordered[Address] {

  def compareTo [b >: Address <% Ordered[b]](y: b): int = y match {
    case Address( otherList ) => list compareTo otherList;
    case _ => -(y compareTo this)
  }
  
}
what happened
/tmp> scalac viewBug.scala
viewBug.scala:6: ambiguous view,
both method view: [a]((a) => scala.Ordered[a])(scala.List[a])scala.Ordered[scala.List[a]] in object List
and  method view: [A]((A) => scala.Ordered[A])(scala.Iterable[A])scala.Ordered[scala.Iterable[A]] in object Iter\
able
add member `compareTo' to argument type scala.List[scala.Int]
    case Address( otherList ) => list compareTo otherList;
                                      ^
one error found
what expected No error.

Despite the bound of compareTo, shouldn't overloading resolution find out that Ordered[scala.List[a]] is intended?

[back to overview]
Changes of this bug report
Martin  edited on  2004-05-13 12:38:13.0