Aladdin - Scala Bugtracking
[#1254] project: compiler priority: low category: missing feature
submitter assigned to status date submitted
Martin Martin open 2007-07-30 12:28:27.0
subject [contrib #726] Downgrade some errors to warnings
code
object Test1 {
  def foo(t : Option[Int]) = t match {
    case None => 1
    case None => 2
  }
}

object Test2 {
  def bar = {
    val baz = 3
  }
}
what happened
test.scala:5: error: unreachable code
                case None => 2
                             ^

and:

test.scala:11: error: block must end in result expression, not in definition
        }
        ^
what expected I suggest these should not prevent compilation, so should be warnings rather than compile errors. Whilst such code is certainly wrong, it is common to want to have these cases compile during development.
[back to overview]
Changes of this bug report
Burak  edited on  2007-08-06 09:44:12.0
I don't know... initially I suggested the same! But then I found that redundant case in Erasure (NotNullType vs _:SubType, see Erasure.scala lines 65...) -- it was there because the check did not work properly, and once I fixed it, this error was detected. Should we go a middle way and make it a warning PLUS add a compiler-option to turn it into an error? That way, we still have a way to make something like "ant dist" abort in these situations.
Burak  edited on  2007-08-06 21:31:40.0