Aladdin - Scala Bugtracking
[#93] project: compiler priority: medium category: bug
submitter assigned to status date submitted
Vincent Martin fixed 2003-08-27 18:40:55.0
subject while (cond == false)
code
object Bug {
  def f(def cond: Boolean) = while (cond == false) {};
  // no bug with "false == cond"
}
what happened
Exception in thread "main" java.lang.AssertionError: boolean -> scala.Function0
        at scalac.backend.jvm.GenJVM.genWidenConversion(GenJVM.java:929)
what expected silent run
[back to overview]
Changes of this bug report
Michel  edited on  2003-08-28 08:05:00.0
This actually seems to be a bug in erasure, which casts the result of the evaluation of "cond" (as "cond" is a def parameters) to Function0, which produces invalid code.
Philippe  edited on  2003-09-02 09:18:19.0
The bug is in uncurry where the argument "cond: boolean" is replaced by "cond: () => Boolean". In the method body, the expression "cond" is replaced by "cond.apply()". The problem is that the 3 tree nodes representing that expression have wrong types. All 3 types contain the type "cond.type" which is incorrect. It should be replaced by "Boolean".
Martin  edited on  2003-09-02 18:55:50.0