ID:2300313
 
BYOND Version:511.1385; 512.1388
Operating System:Linux
Web Browser:Chrome 61.0.3163.100
Applies to:Dream Daemon
Status: Open

Issue hasn't been assigned a status value.
Descriptive Problem Summary:
Defining a list with mixed associative and non-associative elements can cause "runtime error: list index out of bounds"

Numbered Steps to Reproduce Problem:
- Define a list as shown below
- Run

Code Snippet (if applicable) to Reproduce Problem:
// Broken:
var/list/L = list("foo", "foo"=2, "foo")
var/list/L = list("foo", "foo"=2, "bar")
var/list/L = list("foo"=1, "foo"=2, "bar")

// Not broken:
var/list/L = list("foo", "foo"=2, "bar"=3)
var/list/L = list("foo"=1, "foo", "bar")


Expected Results:
Either a compile error, or a valid list

Actual Results:
Runtime error on the line the list is defined

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

When does the problem NOT occur?
- When keys are not repeated
- When all keys following the repeated associative key are associative
- When the repeated key is not associative in the repeats (it may be associative in the first instance without breaking)

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? Unknown

Workarounds: Don't repeat keys in list literals?

What is the actual runtime error?

Also, why would anyone ever do this?
The runtime error is "runtime error: list index out of bounds", on the line the list is defined.

I don't think anyone would make use of repeated-key lists - there might be some niche uses if you want an ordered list of possibly-repeating items with each item associated with a single object, but I can't think of any real-world use for that.

Mostly I submitted because this seems like incorrect behaviour whether the use of said lists is valid or not - if it's valid, the list shouldn't runtime; if it's not, the error should be at compile-time.