ID:2662224
 
Resolved
The ?[] operator didn't chain correctly with the [] operator in all cases, resulting in code failing to compile.
BYOND Version:514
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:
?[] doesnt always work as expected
Numbered Steps to Reproduce Problem:
snippets
Code Snippet (if applicable) to Reproduce Problem:
//Actual structure would look like this
var/list/dat = list("test" = list("item" = 5))

//compiles
var/list/dat
world.log << dat?["test"]

//compiles
var/list/dat
world.log << dat?["test"]?["item"]

//doesnt compile
var/list/dat
world.log << dat?["test"]["item"]


Expected Results:
It compiles
Actual Results:
code.dm:4:error: ?:: invalid expression
code.dm:3:warning: dat: variable defined but not used

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?
Not using ?[] or writing it twice

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.)
Since always it seems
Workarounds:
Not using ?[]
Lummox JR resolved issue with message:
The ?[] operator didn't chain correctly with the [] operator in all cases, resulting in code failing to compile.