Aladdin - Scala Bugtracking
[#459] project: nsc priority: medium category: bug
submitter assigned to status date submitted
Iulian _ fixed 2005-10-15 18:03:01.0
subject [nsc] (bug of the year) Erasure 'erases' useful expressions
code
class Foo extends AnyRef with Application {
  var a = Predef.Array(1, 2, 4, 5);

  def swap(i: Int, j: Int): Unit = {
    val t = a(i); 
    a(i) = a(j); 
    a(j) = t // this will disappear!!!!
  }

  swap(2, 3);
}
what happened
The last assignment in method swap evaporates during erasure phase! It's weird because another expression, for e\
xample a call to println will not dissapear!
what expected To stay there! :-)
[back to overview]
Changes of this bug report
Iulian  edited on  2005-10-17 17:06:47.0
Iulian  edited on  2005-10-18 13:34:38.0