What steps will reproduce the problem?
state S {
method change() {
java.lang.System.out.println("S.change");
this <- T;
}
method foo() {
change(); // Should call S.change
change(); // Should call T.change
}
}
state T {
method change() {
java.lang.System.out.println("T.change");
this <- S;
}
}
method main() {
var s = new S;
s.foo();
}
What is the expected output? What do you see instead?
Should print:
S.change
T.change
but prints
S.change
S.change
This is because the state change is not applied to the this object in the "old
scope" in the calling method foo() but only to the this object in the scope of
S.change(). Thus the type of this in foo() is till S even after the call to
change() returned.
Original issue reported on code.google.com by manuelmohr@gmail.com on 16 Jun 2010 at 4:59
Original issue reported on code.google.com by
manuelmohr@gmail.com
on 16 Jun 2010 at 4:59