Aladdin - Scala Bugtracking
[#180] project: compiler priority: high category: bug
submitter assigned to status date submitted
Matthias Burak fixed 2003-10-07 02:00:16.0
subject Strange pattern matcher behavior
code
case class One();
case class Two();
object Foo with Executable {
  def test(xs: List[Any]) = xs match {
    case List(((One(), Two())* | (One(), One())), One()) => Console.println("case")
    case _ => System.out.println("default");
  }
  test(List());
  test(List(One()));
  test(List(One(), One()));
  test(List(One(), One(), One()));
  test(List(One(), One(), One(), One()));
  test(List(One(), One(), One(), One(), One()));
}
what happened
The program compiles and execution yields the following output:
default
case
default
case
default
case
what expected Expected output:
default
case
default
case
default
default
[back to overview]
Changes of this bug report
Matthias  edited on  2003-10-07 02:00:48.0
Burak  edited on  2003-10-28 15:49:28.0
fixed, the bug was in Label.class when hashing type terms. Now hopefully uses the correct hashing scheme (applies tree.type().hashCode())+hash of arguments.