Aladdin - Scala Bugtracking
[#1134] project: compiler priority: low category: feature
submitter assigned to status date submitted
Sean Martin fixed 2007-05-23 12:42:19.0
subject self values and pattern matching don't mi
code
package test;
trait Test {
  trait ManagedScope{ SelfScope => 
    (null:AnyRef) match {
    case (SelfScope) =>
    }
  }
}
what happened
(crash since it was not implemented by pattern matcher)
what expected that the this-identifier, used as pattern, works like condition "_ eq this"
[back to overview]
Changes of this bug report
Burak  edited on  2007-07-06 16:10:51.0
I implemented Sean's "bug report", which is actually a feature request (SelfScope being a synonyme for "this"). I also rewrote the what happened, what expected fields. Now, after explicitouter, we have
 temp0.isInstanceOf[ManagedScope.this.type]().&&({
          exit(());
          true
        });
which is correct. However, after erasure, this becomes
        temp0.$isInstanceOf[test.Test#ManagedScope]().&&({
          exit(scala.runtime.BoxedUnit.UNIT);
          true
        });
which is incorrect -- I expect in many places that "z.instanceOf[something.this.type]" becomes "z eq something", so it's strange that this thing should be an exception. It would be good if you could have a look, although I doubt anybody except Sean will ever notice the erroneous behavior.
Martin  edited on  2007-07-17 18:59:11.0