BYOND Version:511
Operating System:Windows 7 Home Premium 64-bit
Web Browser:Chrome 64.0.3282.167
Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
Descriptive Problem Summary:
The "in" keyword, when used in expressions, is executed after assignments.
Numbered Steps to Reproduce Problem:
1) Make an expression that uses both an assignment and the in keyword, in the same expression
2) Compile
3) Execute
4) Notice how the assignment is done first, and the rest of the code is ignored
Code Snippet (if applicable) to Reproduce Problem:
We tried this code with the ss13 /tg/ IRC dm bot:
!dm var/a = "t";; var/list/L = list();; var/b = "abc";; b += a in L ? "test" : "";; b
and it returned "abct" when it should have returned "abc"
var/a = "t"
var/list/L = list()
var/b = "abc"

b = a in L ? "test" : ""
world << b

Expected Results:
I expected
a in L ? "test" : ""
to be executed for first, then the value produced to be assigned to b. So b would have to be:
b = ""
since a is not a part of the list L.
Actual Results:
b gets set to "t", aka
b = a
is done, and the rest of the expression is ignored.
Does the problem occur:
Every time? Or how often? Everytime
In other games? unrelated
In other user accounts? unrelated
On other computers? Yes

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 to download old versions for testing.)
Haven't checked
Parentheses can be used to force the expression to evalutate correctly, so you can do b = (a in L) ? "test" : "" so that the keyword "in" is evalutated before the assignment. But it shouldn't be required.
"in" has the lowest precedence of any operator, so this is expected. so, it's more of a feature request than a bug report.

the rule is, if it's not in this list, it's lower than the lowest thing:

[] () . / :
~ ! - ++ --
* / %
+ -
< <= > >=
<< >>
== != <>
& ^ |
= += -= *= /= &= |= ^= <<= >>=
Shouldn't assignment be the LOWEST priority? Out of everything? There's never a time where you'd want to assign before evaluating ALL the things you want to assign (if you're sane, anyway).
I'll take a look at this just to see where it's at, because the assignment operators are really meant to be at the bottom of the precedence list. It's possible this is a bug introduced by changes to the assignment operators, so it's worth investigating.