ID:1958696
 
BYOND Version:509.1305
Operating System:Windows 8 Pro 64-bit
Web Browser:Chrome 45.0.2454.101
Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
Descriptive Problem Summary:
The following snippet produces a duplicate variable error. This is not the normal behavior for exceptions.

Code Snippet (if applicable) to Reproduce Problem:
/mob/Login()
{
try { var/x = 1 + 1; suppressWarning(x); }
catch (var/ex) { /* ... */ }

try { var/x = 1 + 1; suppressWarning(x); }
catch (var/ex) { /* ... */ }
}


Expected Results:
This code should compile.

Actual Results:
The code won't compile. The compiler says:

error: ex: duplicate definition
error: ex: duplicate definition


Does the problem occur:
Every time? Or how often?
Every time.
In other games?
Yes.
In other user accounts?
Yes.
On other computers?
Yes.

When does the problem NOT occur?
The problem does not occur when you provide different names for the exceptions (i.e., "ex2", "ex3" and so forth). This is not ideal, and by far not the norm.

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
Unknown.

Workarounds:
Rename the variable in subsequent exceptions.
This is because the var is being defined actually in the main block instead of a private block. It's a quirk in the way it's compiled, which I haven't been able to handle properly yet.
Is this a difficult fix?
Moderate. I'll get to it at some point and try to make it work, but in the meantime I advise declaring the exception var at the top of the proc instead..