ID:2828915
 
Resolved
Implicit return types in procs such as operator+= could be incorrect in some situations, intermittently spitting out errors about undefined vars.
BYOND Version:515.1590
Operating System:Windows 10 Home
Web Browser:Chrome 106.0.0.0
Applies to:Dream Maker
Status: Resolved (515.1591)

This issue has been resolved.
Descriptive Problem Summary:
Sometimes, overloaded operators will decide to find an error and spit out an error. This doesn't appear to have any rhyme or reason, and will clear up on the next compile. This can take five compiles, it can take ten, it can take twenty.
error: operator+=: undefined var

Numbered Steps to Reproduce Problem:
1. Compile until overloaded operator fails to compile with the undefined var error.

Code Snippet (if applicable) to Reproduce Problem:
datumtest
proc
operator+=()
world << "random code to satisfy the gods"


Expected Results:
Compiles 100% of the time with 0 errors.

Actual Results:
Occasionally decides to error and throw an error: operator+=: undefined var. Compiling again makes the error magically vanish until it randomly occurs again on a later compile.

When does the problem occur:
Sometimes. Maybe one in every fifteen to twenty compiles?

When does the problem NOT occur?

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.)

514.1589

Workarounds:

Being an intermittent bug, this one's gonna be hard to pin down. Is there any way to make it happen more reliably?
In response to Lummox JR
At the moment, it doesn't seem so?
It happens with other operators like -=, |=, %%=, ++ as well.
It does not happen with ~=, <=, <, ~=, [], _turn, "", >>, <<

A workaround appears to be to do
proc/operator+=()

instead of
proc
operator+=()

It does not appear to cause the compiler issues when directly proc/'d.
I've narrowed this down to an implicit return type that's being added, but can't figure out yet why sometimes it's added incorrectly. Getting there.
Lummox JR resolved issue with message:
Implicit return types in procs such as operator+= could be incorrect in some situations, intermittently spitting out errors about undefined vars.