plaidgroup / plaid-lang

The Plaid Programming Language Tools
11 stars 1 forks source link

Names not checked for uniqueness on match cases #57

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
According to the language spec you can give a different name to a reference 
when it is matched with a particular tag. It doesn't look like these names are 
being checked for uniqueness, meaning that the following code gets through to 
the code generator, producing Java code which then fails to compile due to the 
reuse of the name "p".

###
package bug;

state NamingBug {
    method x(p) {
        match(p) {
            case None { false }
            case Some p { true }
        }
    }
}
###

Output from compilation with plaidc:

###
/Users/iainmcgin/bug/NamingBug.java:94: p is already defined in 
invoke(plaid.runtime.PlaidObject,plaid.runtime.PlaidObject)
                        final plaid.runtime.PlaidObject p;
###

I stumbled across this while implementing some standard library pieces, it was 
a mistake, not something I'd actually expect to work.

Original issue reported on code.google.com by iainmc...@gmail.com on 30 Jul 2011 at 3:58

GoogleCodeExporter commented 9 years ago
The spec changed and you can only specify a pattern but not identifier anymore.

Original comment by sven.stork.CMU@gmail.com on 30 Jul 2011 at 7:29