Aladdin - Scala Bugtracking
[#245] project: compiler priority: high category: bug
submitter assigned to status date submitted
Philippe Martin fixed 2003-12-01 17:02:49.0
subject overloading resolution conflits with corece methods
code
class Value {
  def coerce: Int = 0;
}

object Test {

  def foo(i: Int): Int = 0;

  def fun0         : Value = null;
  def fun0(i: Int ): Value = null;

  def fun1(i: Int ): Value = null;
  def fun1(l: Long): Value = null;

  foo(fun0           );
  foo(fun1(new Value));

}
what happened
tmp/test.scala:15: type mismatch;
 found   : Value#0  (scala#1.Int#2)Value#0
 required: scala#1.Int#2
  foo(fun0           );
      ^
tmp/test.scala:16: overloaded method fun1#3 of type (scala#1.Int#2)Value#0  (scala#1.Long#4)Value#0 cannot \
be applied to (Value#0) with expected result type scala#1.Int#2
  foo(fun1(new Value));
          ^
what expected

no errors

[back to overview]
Changes of this bug report
Martin  edited on  2003-12-13 23:13:17.0