Lone parenthesized ternaries throw compiler warning "warning: : operation has no effect here" even though they work fine otherwise. If it isn't parenthesized or isn't alone on the line (ex: assigned to a var) the compiler doesn't give a warning.
Steps to Reproduce Problem:
The third code snippet can be compiled as is to see the issue yourself. Other than the warning everything works fine.
Code Snippet (if applicable) to Reproduce Problem:
Works fine
name == "test" ? do_foo() : do_bar()
Throws "warning: : operation has no effect here"
(name == "test" ? do_foo() : do_bar())
/proc/do_foo()
usr << "foo"
/proc/do_bar()
usr << "bar"
/mob/verb/test_paren()
(name == "test" ? do_foo() : do_bar())
Expected Results:
No compiler warning
Actual Results:
A compiler warning for functional code
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked?
This is also an issue on 511.1385
Workarounds:
Don't use parentheses. However in the case of a macro that can be used both by itself or in a more complex arrangement you need to have separate macros.