Aladdin - Scala Bugtracking
[#430] project: compiler priority: low category: bug
submitter assigned to status date submitted
Philippe Martin fixed 2005-05-13 15:14:47.0
subject No view from Unit, Byte and Short to Ordered
code
object Test {
  def foo[T](x: Ordered[T] ): Unit = ();

  def bar(x: Unit   ): Unit = foo(x);
  def bar(x: Boolean): Unit = foo(x);
  def bar(x: Byte   ): Unit = foo(x);
  def bar(x: Short  ): Unit = foo(x);
  def bar(x: Int    ): Unit = foo(x);
  def bar(x: Long   ): Unit = foo(x);
  def bar(x: Float  ): Unit = foo(x);
  def bar(x: Double ): Unit = foo(x);
}
what happened
tmp/test.scala:4: type mismatch;
 found   : scala.Unit
 required: scala.Ordered[]
  def bar(x: Unit   ): Unit = foo(x);
                                  ^
tmp/test.scala:6: type mismatch;
 found   : scala.Byte
 required: scala.Ordered[]
  def bar(x: Byte   ): Unit = foo(x);
                                  ^
tmp/test.scala:7: type mismatch;
 found   : scala.Short
 required: scala.Ordered[]
  def bar(x: Short  ): Unit = foo(x);
                                  ^
three errors found
what expected The types Byte and Short should have a view to Ordered and maybe also Unit.
[back to overview]
Changes of this bug report
Martin  edited on  2006-03-30 15:10:10.0