Aladdin - Scala Bugtracking
[#320] project: compiler priority: high category: bug
submitter assigned to status date submitted
Stephane Martin fixed 2004-04-21 12:51:57.0
subject NullPointerException in typechecker
code
object test with Application {
  val xss = List(2, 4, 1); // correct: List(List(2, 4, 1));
  val ys = xss flatMap {
    case x :: xs => List(x)
    case Nil => Nil
  }
}
what happened
test.scala:4: constructor cannot be instantiated to expected type;
 found   : scala.::[b?]
 required: scala.Int
    case x :: xs => List(x)
           ^
test.scala:5: type mismatch;
 found   : scala.Nil
 required: scala.Int
    case Nil => Nil
         ^
Exception in thread "main" java.lang.NullPointerException
what expected Compiler should print out an error message.
[back to overview]
Changes of this bug report
Martin  edited on  2004-04-22 10:32:51.0