Use of if/else conditions around assign statements in Macros

How is this scenario finally resolved?
I am trying out something similar in my testbench, but seeing cross-module reference compilation errors.
The “thread” link above does not seem to direct to exact thread which discusses the resolution.