Aladdin - Scala Bugtracking
[#1024] project: compiler priority: medium category: bug
submitter assigned to status date submitted
Nikolay Martin not repro 2007-03-26 12:38:09.0
subject [contrib #406] Crash when using parallel assignment with explicit generic type
code
val (a: List[_], b) = (List(1 ,2 ,3 ), 4)
what happened
exception when transforming  private[this] val x$0: (scala.List[scala.Int], scala.Int) = (new (scala.\
List[scala.Int], scala.Int)(scala.List.apply[scala.Int](Array[scala.Int]{1, 2, 3}), 4)) : [scala.unchecked] (sca\
la.List[scala.Int], scala.Int) match {
  case (scala.List[scala.Int],scala.Int)(scala.List[scala.Int], scala.Int)((a @ (_) : scala.List[scala.Int]), (b\
 @ _)) => new (scala.List[scala.Int], scala.Int)(a, b)
}
exception when transforming java.lang.Object with scala.ScalaObject {
  def this(): object line0$object = {
    line0$object.super.this();
    ()
  };
   private[this] val x$0: (scala.List[scala.Int], scala.Int) = (new (scala.List[scala.Int], scala.Int\
)(scala.List.apply[scala.Int](Array[scala.Int]{1, 2, 3}), 4)) : [scala.unchecked] (scala.List[scala.Int], scala.\
Int) match {
    case (scala.List[scala.Int],scala.Int)(scala.List[scala.Int], scala.Int)((a @ (_) : scala.List[scala.Int]), \
(b @ _)) => new (scala.List[scala.Int], scala.Int)(a, b)
  };
  private[this] val a: scala.List[scala.Int] = line0$object.this.x$0._1();
    def a(): scala.List[scala.Int] = line0$object.this.a;
  private[this] val b: scala.Int = line0$object.this.x$0._2();
    def b(): scala.Int = line0$object.this.b
}
exception when transforming final class line0$object extends java.lang.Object with scala.ScalaObject {
  def this(): object line0$object = {
    line0$object.super.this();
    ()
  };
   private[this] val x$0: (scala.List[scala.Int], scala.Int) = (new (scala.List[scala.Int], scala.Int\
)(scala.List.apply[scala.Int](Array[scala.Int]{1, 2, 3}), 4)) : [scala.unchecked] (scala.List[scala.Int], scala.\
Int) match {
    case (scala.List[scala.Int],scala.Int)(scala.List[scala.Int], scala.Int)((a @ (_) : scala.List[scala.Int]), \
(b @ _)) => new (scala.List[scala.Int], scala.Int)(a, b)
  };
  private[this] val a: scala.List[scala.Int] = line0$object.this.x$0._1();
    def a(): scala.List[scala.Int] = line0$object.this.a;
  private[this] val b: scala.Int = line0$object.this.x$0._2();
    def b(): scala.Int = line0$object.this.b
}
exception when transforming package  {
  final class line0$object extends java.lang.Object with scala.ScalaObject {
    def this(): object line0$object = {
      line0$object.super.this();
      ()
    };
     private[this] val x$0: (scala.List[scala.Int], scala.Int) = (new (scala.List[scala.Int], scala.I\
nt)(scala.List.apply[scala.Int](Array[scala.Int]{1, 2, 3}), 4)) : [scala.unchecked] (scala.List[scala.Int], scal\
a.Int) match {
      case (scala.List[scala.Int],scala.Int)(scala.List[scala.Int], scala.Int)((a @ (_) : scala.List[scala.Int])\
, (b @ _)) => new (scala.List[scala.Int], scala.Int)(a, b)
    };
    private[this] val a: scala.List[scala.Int] = line0$object.this.x$0._1();
      def a(): scala.List[scala.Int] = line0$object.this.a;
    private[this] val b: scala.Int = line0$object.this.x$0._2();
      def b(): scala.Int = line0$object.this.b
  }
}
Exception in thread "main" java.util.NoSuchElementException: head of empty list
        at scala.Nil$.head(List.scala:1144)
        at scala.Nil$.head(List.scala:1141)
        at scala.tools.nsc.symtab.Types$SubstMap.subst$0(Types.scala:1791)
        at scala.tools.nsc.symtab.Types$SubstMap.apply(Types.scala:1795)
        at scala.tools.nsc.symtab.Types$SubstMap.apply(Types.scala:1778)...
what expected no crash
[back to overview]
Changes of this bug report
Nikolay  edited on  2007-03-26 12:47:25.0
contribution #406. I edited the code sample by replacing List[Int] with List[_] in the typed tuple element declaration because otherwise it gives a warning and doesn't crash. 2.4.0-final crashes on both. I created a test case under pending/pos/contrib_406.scala for your bug-fixing convenience :)
Martin  edited on  2007-03-30 15:30:31.0
Martin  edited on  2007-06-05 17:40:48.0
Martin  edited on  2007-07-17 19:03:08.0
fixed on pre 2.6.0 trunk