plaidgroup / plaid-lang

The Plaid Programming Language Tools
11 stars 1 forks source link

Variable lookup for write accesses is broken #32

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

var x = 0;

method foo() {
    x = 5;  
    java.lang.System.out.println(x);
}

state S {
    method bar() {
        x = 10;
        java.lang.System.out.println(x);
    }
}

method main() {
    foo();
    (new S).bar();
}

Or see attachment.

What is the expected output? What do you see instead?

The expected behavior would be that both writes refer to the global 
variable 'x' and the output is:
5
10

Instead what you see is this:
5
"Object does not have member x. Assignment failed."

So the write access in the method "bar" does not work. In general one 
would expect write accesses to always refer to the most local variable 
which is in scope, i.e. local -> field -> global.
Currently, we are using a strange mix of static and dynamic lookup for 
assignments which leads to this problem. We check statically if a "this" 
object is available and delay the check if the object really has the 
needed member until runtime.

Original issue reported on code.google.com by manuelmohr@gmail.com on 2 Jun 2010 at 12:28

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by mhahn...@gmail.com on 2 Jun 2010 at 2:38

GoogleCodeExporter commented 9 years ago
New scoping system has fixed this.

Original comment by manuelmohr@gmail.com on 10 Jun 2010 at 7:09