Forward Reference Error in unittests

rbscott tjonsies818 at
Wed Dec 4 09:52:13 UTC 2019

On Tuesday, 3 December 2019 at 11:31:40 UTC, MoonlightSentinel 
> On Tuesday, 3 December 2019 at 10:30:34 UTC, mipri wrote:
>> Likewise this fails, but would succeed if foo were moved
>> out of the unit test:
>> unittest {
>>     void foo(int x) { writeln(x); }
>> }
> Not a forward reference error, local symbols are excluded from 
> UFCS (see

I see, thanks for the explanation about unittests being a special 
case of functions. That is really helpful context and makes sense 
since functions should evaluate sequentially. A little surprised 
the same restrictions apply to a static struct declared inside of 
the unittest, but that is easy to work around by moving the 
declarations to the version section.


More information about the Digitalmars-d mailing list