Aladdin - Scala Bugtracking
[#45] project: compiler priority: medium category: bug
submitter assigned to status date submitted
Stephane Martin fixed 2003-06-19 19:21:09.0
subject NullPointerException
code
object Main {

    def main(args: Array[String]) = {
        def foo[Int](x: Int): Int = null;
        val y1 = null;
        val y2 = foo(2);
        ()
    }

}
what happened
Exception in thread "main" java.lang.NullPointerException
        at Main$.main(src/Main.scala:6)
        at Main.main(src/Main.scala)
what expected src/Main.scala:5: type mismatch; found : scala.AllRef required: scala.Int def foo[Int](x: Int): Int = null; ^ one error found
[back to overview]
Changes of this bug report
Martin  edited on  2003-07-04 14:16:16.0
Now you get: bug45.scala:4: type mismatch; found : scala.AllRef required: Int def foo[Int](x: Int): Int = null; ^ one error found Note that Int != scala.Int, it's a local type variable!!!