ID:2628069
 
Resolved
Escaped line breaks in #define macro arguments were handled incorrectly.
BYOND Version:513
Operating System:Windows 10 Home
Web Browser:Chrome 86.0.4240.75
Applies to:Dream Maker
Status: Resolved (513.1539)

This issue has been resolved.
Descriptive Problem Summary:
When you have a nested macros set up and in the macro call to a higher level nested macro you escape a newline, it doesn't seem like it escapes the newlines properly when it calls the lower level nested macro.

Numbered Steps to Reproduce Problem:
1. Download test environment. (https://www.dropbox.com/s/ojl310ausmgfwrt/ macro_nesting_stupid_stuff.zip?dl=0)
2. Compile.
3. Observe compile error.

Code Snippet (if applicable) to Reproduce Problem:
#define B(X) X
#define A(X) B(X)

/obj/foo
var/bar = 11
var/baz = 20

/obj/foo/New()
..()
A(src.bar\
src.baz)


Expected Results:
compiles without error.

Actual Results:
macro_nesting_stupid_stuff.dme:16:error: missing ) in macro call
macro_nesting_stupid_stuff.dme:17:error: ): expected }
macro_nesting_stupid_stuff.dm:13:error: location of top-most unmatched {

Does the problem occur:
Every time? Or how often?
Yes
In other games?
Yes, I made a new test environment.
In other user accounts?
Yes, It's an issue with the compiler.
On other computers?
Yes.

When does the problem NOT occur?
I assume you can work around it by figuring out a way to avoid nesting macros with escaped newlines in their calls.

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.)
Not sure.

Workarounds:
Just avoid nesting macros if you want to escape newlines in the macro arguments.
bumping this because it's been nearly 2 months without replies and i'd at least like some closure as to whether or not this is intended or going to be fixed.
There's a nonzero chance that this is id:2561405, but I'm definitely not certain.
That one should probably be moved from beta bugs to bug reports since even if it had been unique to the beta at the time, that version is now stable.
I do plan to look into this. I doubt it's intended behavior at all, but it's also a situation that shouldn't come up in any realistic code so it's been very low priority.
Lummox JR resolved issue with message:
Escaped line breaks in #define macro arguments were handled incorrectly.
This did not tie in with id:2561405 as far as I can tell, nor to id:2061007 which was linked to that issue and may be the same thing. However in the process of fixing id:2061007 I was in the guts far enough that I was able to fix this as well.

Please note that the example code will not compile correctly and will result in bizarre errors, because the compiler is now seeing src.bar src.baz by itself after the macro substitution and it has no idea what to make of that.
thank you lummox! sorry for bugging you