sstork / plaid-lang

Automatically exported from code.google.com/p/plaid-lang
0 stars 0 forks source link

Passing var to method which takes multiple arguments generates erroneous code #26

Closed GoogleCodeExporter closed 9 years ago

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

method foo(x, y) {
}

method main() {
  var x = 0;
  foo(x, 0);
}

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

This program compiles just fine but the generated Java source contains an 
error: "Cannot refer to a non-final variable x inside an inner class 
defined in a different method".
Changing the declaration of x from "var" to "val" fixes the problem 
because x is then declared final in the Java source. It is important that 
the method takes multiple arguments, it works flawlessly with just one.

Original issue reported on code.google.com by manuelmohr@gmail.com on 28 May 2010 at 9:51

GoogleCodeExporter commented 9 years ago
Yes, this should work and it needs to be fixed.

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

GoogleCodeExporter commented 9 years ago

Original comment by manuelmohr@gmail.com on 2 Jun 2010 at 8:49

GoogleCodeExporter commented 9 years ago
Can be solved in a clean way using the new scoping system.

Original comment by manuelmohr@gmail.com on 3 Jun 2010 at 6:10

GoogleCodeExporter commented 9 years ago
New scoping system solved this.

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