Open GoogleCodeExporter opened 9 years ago
It seems that shadowing works for local variables but not for method parameters.
Running the code
state S {
val foo = 10;
method bar(foo) {
}
}
method main() {
var s = new S;
s.bar(5);
}
prints the error "Cannot insert 'foo': already defined in current scope.". If
'foo' is a local variable (and no method parameter) no error is printed. In
Java, method parameters behave just like local variables and we should probably
stick with that, too.
Original comment by manuelmohr@gmail.com
on 14 Jun 2010 at 3:53
The lookup rules appear to handle method parameters incorrectly, too:
state T {
method foo() {
23
}
method bar(foo) {
java.lang.System.out.println(foo());
}
}
method main() {
(new T).bar(5);
}
the output will be 23 because the lookup chooses the field/method before
considering the method parameters.
Original comment by manuelmohr@gmail.com
on 14 Jun 2010 at 6:02
I've fixed two small issues, so treeTest.plaid is working again. There's also
an issue related to state change which is why turing.plaid is still broken.
Original comment by manuelmohr@gmail.com
on 14 Jun 2010 at 9:41
Original comment by manuelmohr@gmail.com
on 16 Jun 2010 at 5:00
[deleted comment]
Prefixing certain methods and fields with "this." managed to workaround the bug
and make turing.plaid work. However, this does not solve the real problem.
Original comment by matta...@gmail.com
on 1 Jul 2010 at 6:28
Original issue reported on code.google.com by
manuelmohr@gmail.com
on 14 Jun 2010 at 2:38