Aladdin - Scala Bugtracking
[#982] project: compiler priority: high category: bug
submitter assigned to status date submitted
Burak Martin noise 2007-03-09 15:11:08.0
subject shorthand tuple patterns messed up by typer?
code
object tmp {

  val x: AnyRef = Some(1,2)

  x match {
    case Some(1,2) =>
  }
}
what happened
pattern matcher crashes in subtype call
tsf-wpa-2-155:~/Documents/svn/scala buraq$ ./build/quick/bin/scalac -d /tmp /tmp/ga.scala  -print:typer 
[[syntax trees at end of typer]]// Scala source: ga.scala
package  {
  final object tmp extends java.lang.Object with scala.ScalaObject {
    def this(): object tmp = {
      tmp.super.this();
      ()
    };
    private[this] val x: java.lang.Object = scala.Some[(scala.Int, scala.Int)](scala.this.Tuple2[scala.Int, scal\
a.Int](1, 2));
      def x: java.lang.Object = tmp.this.x;
    tmp.this.x match {
      case (scala.Any)scala.Some[scala.Any]((scala.Any,scala.Any)(scala.Any, scala.Any)(1, 2)) => ()
    }
  }
}

exception when transforming java.lang.Object with scala.ScalaObject {
  def this(): object tmp = {
    tmp.super.this();
    ()
  };
  private[this] val x: java.lang.Object = new scala.Some[(scala.Int, scala.Int)](new (scala.Int, scala.Int)(1, 2\
));
    def x(): java.lang.Object = tmp.this.x;
  tmp.this.x() match {
    case (scala.Any)scala.Some[scala.Any]((scala.Any,scala.Any)(scala.Any, scala.Any)(1, 2)) => ()
  }
}
exception when transforming final class tmp extends java.lang.Object with scala.ScalaObject {
  def this(): object tmp = {
    tmp.super.this();
    ()
  };
  private[this] val x: java.lang.Object = new scala.Some[(scala.Int, scala.Int)](new (scala.Int, scala.Int)(1, 2\
));
    def x(): java.lang.Object = tmp.this.x;
  tmp.this.x() match {
    case (scala.Any)scala.Some[scala.Any]((scala.Any,scala.Any)(scala.Any, scala.Any)(1, 2)) => ()
  }
}
exception when transforming package  {
  final class tmp extends java.lang.Object with scala.ScalaObject {
    def this(): object tmp = {
      tmp.super.this();
      ()
    };
    private[this] val x: java.lang.Object = new scala.Some[(scala.Int, scala.Int)](new (scala.Int, scala.Int)(1,\
 2));
      def x(): java.lang.Object = tmp.this.x;
    tmp.this.x() match {
      case (scala.Any)scala.Some[scala.Any]((scala.Any,scala.Any)(scala.Any, scala.Any)(1, 2)) => ()
    }
  }
}
Exception in thread "main" scala.MatchError: null
        at scala.runtime.ScalaRunTime$.boxArray(ScalaRunTime.scala:126)
        at scala.tools.nsc.symtab.Types$class.isSubType0(Types.scala:2130)
        at scala.tools.nsc.symtab.SymbolTable.isSubType0(SymbolTable.scala:10)
        at scala.tools.nsc.symtab.Types$class.isSubType(Types.scala:2118)
        at scala.tools.nsc.symtab.SymbolTable.isSubType(SymbolTable.scala:10)
        at scala.tools.nsc.matching.PatternNodes$Header.optimize1(PatternNodes.scala:364)
...
what expected clean compile
[back to overview]
Changes of this bug report
Burak  edited on  2007-03-09 15:13:31.0
I should add, this file crashes too, same trace
object tmp {

  val x: AnyRef = Some(1,2)

  x match {
    case Some(Tuple2(1,2)) =>
  }
}
Burak  edited on  2007-03-09 15:22:19.0
hold on, maybe it was just my compile
Burak  edited on  2007-03-09 15:31:33.0
please ignore it, it was something broken in my modified build.