Aladdin - Scala Bugtracking
[#339] project: compiler priority: medium category: bug
submitter assigned to status date submitted
Burak Martin fixed 2004-06-04 14:17:04.0
subject Inference does not handle List() correctly
code
object testList {
  List() match {case _ =>}
}
what happened
Exception in thread "main" java.lang.AssertionError: type A in method apply
	at scalac.transformer.LambdaLift$FreeVars.markFree(LambdaLift.java:178)
...
This is because there is a type variable that "falls from the sky":
[[syntax trees at refcheck (after analyze)]]
// Scala source: testList.scala
final object testList extends java.lang.Object() with scala.ScalaObject() {
  scala.List.apply[A]().match({
      case _ => ()
    })
};
what expected analyzer to output
scala.List.apply[All]
. Strangely, here it works:
object testList {
  val a = List();
}
[[syntax trees at lambdalift (after transmatch)]]
// Scala source: testList.scala
final class testList() extends java.lang.Object() with scala.ScalaObject() {
  private val a$: scala.List[scala.All] = scala.List.apply[scala.All](scala.Nil);
  final def a(): scala.List[scala.All] = testList.this.a$;
  override def $tag(): scala.Int = 0
};
[back to overview]
Changes of this bug report
Philippe  edited on  2004-06-04 15:47:16.0
Same bug as 338
Martin  edited on  2004-07-02 14:16:36.0