Aladdin - Scala Bugtracking
[#141] project: compiler priority: medium category: feature
submitter assigned to status date submitted
Philippe Martin fixed 2003-09-12 14:12:03.0
subject polymorphic method tree has wrong type
code
object Test {
  def foo[X](): X = foo();
}
what happened
The expression foo() generates the following tree (after Analyzer with -types):
 Test{Test.type}.foo{()scala.All}[scala.All]{()scala.All}(){scala.All}
The type of the ident foo is ()scala.All
what expected

The type should be [X]()X.

I have a version of Infer.java that solves the problem, but to me, it looks more like a big hack. There is probably a better solution.

[back to overview]
Changes of this bug report
Philippe  edited on  2003-09-12 15:17:44.0
added title
Martin  edited on  2003-09-12 16:33:00.0
I think that ()scala.All is the correct type in the Ident node. Reason: Since the type variable X is covariant in the result type we can pick the best possible one, i.e. scala.All.
Martin  edited on  2003-09-12 16:33:15.0
Martin  edited on  2003-09-16 15:42:56.0
I misunderstood the problem before. Philippe was right in his diagnosis. Anyway it's fixed now.