ID:2561405
 
Resolved
BYOND Version:513.1513 and 1517
Operating System:Windows 10 Home 64-bit
Web Browser:Chrome 80.0.3987.149
Applies to:Dream Maker
Status: Resolved

This issue has been resolved.
First of all, it's quite possible that this also happens in the stable version, but I've only tested it in beta, so I'm putting it here to be safe.

Descriptive Problem Summary:
If there is a backslash in a string which is itself in an embedded expression within another string, and this whole thing is fed into a macro that embeds it within yet another string, the character immediately following said backslash will be duplicated, but only if the nesting depth of the embedded statement is right (it alternates between happening and not happening).

Numbered Steps to Reproduce Problem:
Just mess around with the following snippets. A list of steps for this would probably be even more painful to read than to write.

Code Snippet (if applicable) to Reproduce Problem:
Works:
#define print(msg) world.log << "[msg]"
var/datum/D = new()
print("\ref[D]")


Doesn't work:
#define print(msg) world.log << "[msg]"
var/datum/D = new()
print("["\ref[D]"]")


Works again:
#define print(msg) world.log << "[msg]"
var/datum/D = new()
print("["["\ref[D]"]"]")


Also works:
var/datum/D = new()
world.log << "["["\ref[D]"]"]"


Obviously doesn't work but still helps show the error:
#define print(msg) world.log << "[msg]"
var/datum/D = new()
print("["[\asdf]"]")


And here we see that my above description isn't quite right if you don't mind writing invalid code:
#define print(msg) world.log << "[msg]"
var/datum/D = new()
print(\asdf)


Expected Results:
1-4: Printed ref
5-6: error: asdf: undefined var

Actual Results:
1: Printed ref
2: error: text"\rref[]": undefined text macro or escape sequence: \rref[]
3-4: Printed ref
5-6: error: aasdf: undefined var (Note the doubled a)

Does the problem occur:
Every time? Or how often?
Every time.
In other games?
Presumably.
In other user accounts?
There's no login for the compiler.
On other computers?
Yes.

When does the problem NOT occur?
If the embedded expressions aren't nested to certain depths and if the macro isn't involved.

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.)
Tested in 1513 and 1517, and present in both. No idea if it was not present in any older builds.

Workarounds:
Nest the expression one layer deeper, I guess?
It wouldn't surprise me if this is related to http://www.byond.com/forum/post/2061007.
GinjaNinja may be right about the relationship to the other bug. Please retest in 513.1539.
It does indeed seem to be fixed.
Lummox JR resolved issue