Aladdin - Scala Bugtracking
[#224] project: compiler priority: medium category: bug
submitter assigned to status date submitted
Philippe Burak fixed 2003-11-13 10:53:33.0
subject ill typed code generated by transmatch
code
case class OneN() {
  def bind(xs: List[Any]): Int = xs match {
    case List( y @ OneN() ) => 0;
  }
}
what happened
[[Trees after phase transmatch]]
// Scala source: tmp/test.scala
case class OneN() extends scala.Object() {
  def bind(xs: scala.List[scala.Any]): scala.Int = {
    val temp$0: scala.List[scala.Any] = xs;
    var $result$0: scala.Int = 0;
    if (if (temp$0.isInstanceOf[scala.List[scala.Any]]().$amp$amp(temp$0.asInstanceOf[scala.List[scala.Any]]().l\
ength().$eq$eq(1)))
      {
        val temp$1: scala.List[scala.Any] = temp$0.asInstanceOf[scala.List[scala.Any]]();
        if (temp$1.apply(0).isInstanceOf[OneN]())
          {
            val temp$2: OneN = temp$1.apply(0).asInstanceOf[OneN]();
            val y: OneN = temp$1.apply(0);
            $result$0 = 0;
            true
          }
        else
           false
      }
    else
       false)
      $result$0
    else
       scala.MatchError.fail[scala.Int]("tmp/test.scala", 2)
  };
  override def toString(): java.lang.String = "OneN";
  override def equals(that: scala.Any): scala.Boolean = if (that.isInstanceOf[OneN]())
    true
  else
     false;
  override def hashCode(): scala.Int = OneN.this.getClass().hashCode();
  override def $tag(): scala.Int = 2462408
};

The assignement val y: OneN = temp$1.apply(0); is ill typed. This bugs is similar to bug 214.\

what expected

No ill typed tree after transmatch

[back to overview]
Changes of this bug report
Burak  edited on  2003-11-27 15:38:11.0
fixed, indeed the same problem as in 214.