ID:2661309
 
Resolved
The chaining dot/colon operators and the [] and ?[] operators didn't play together nicely, owing to the chaining operators having a lower precedence. They actually should have the same precedence, and now they do.
BYOND Version:513
Operating System:Windows 10 Home 64-bit
Web Browser:Chrome 88.0.4324.190
Applies to:Dream Maker
Status: Resolved (514.1550)

This issue has been resolved.
Descriptive Problem Summary:

Code Snippet (if applicable) to Reproduce Problem:
/datum/cat
var/list/l = list("meow" = list())

/proc/main()
var/list/init = list()
init["cat"] = new /datum/cat
init["cat"].l["meow"] += "mew"


Expected Results:
It works
Actual Results:
Undefined variable runtime

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


When does the problem NOT occur?
see workaround

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.)
Confirmed runtimed on 514.1545, 514.1546, 513.1536

Workarounds:
/datum/cat
var/list/l = list("meow" = list())

/proc/main()
var/list/init = list()
init["cat"] = new /datum/cat
var/ref = init["cat"].l["meow"]
ref += "mew"


It should also be noted that adding a key to list l
ie
l["key"] = "mow"
works
Wow. This bug was a doozy. Apparently the chaining dot operator and the index operator should've been considered equals all along when it comes to precedence. (Probably the proc call operation should be as well, but the way it's set up will work fine.)

I'm gonna have to run some tests against SS13 to make sure this radical change doesn't break anything. It shouldn't according to the other tests I've done, but just to be safe...
Lummox JR resolved issue with message:
The chaining dot/colon operators and the [] and ?[] operators didn't play together nicely, owing to the chaining operators having a lower precedence. They actually should have the same precedence, and now they do.