plaidgroup / plaid-lang

The Plaid Programming Language Tools
11 stars 1 forks source link

New scoping system handles state change incorrectly #44

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
This should be fixed.

Original comment by manuelmohr@gmail.com on 1 Oct 2010 at 7:10