Why is the error message coming by the end of the compilation?

bauss jj_1337 at live.dk
Sat Apr 14 08:16:26 UTC 2018


On Friday, 13 April 2018 at 21:22:13 UTC, Steven Schveighoffer 
wrote:
> On 4/13/18 4:50 PM, bauss wrote:
>> I can't seem to reproduce this with any other smaller 
>> projects, so my question is really what could trigger this 
>> behavior.
>> 
>> See: https://i.imgur.com/OmqJ8Sr.png
>> 
>> Whenever I try to just do this kind of thing by itself then it 
>> behaves correctly.
>> 
>> Ex: (As you can see it prints the error messages in the order 
>> it should.)
>> https://run.dlang.io/
>> 
>> What I'm doing is basically this:
>>      static foreach (viewResult; generateViewsResult)
>>      {
>>        pragma(msg, "Compiling: " ~ viewResult.name);
>>        mixin(viewResult.source);
>>        pragma(msg, "Compiled: " ~ viewResult.name);
>>      }
>> 
>> I would've expect the compiling to be before the error 
>> message, but the compiled after the error message.
>
> It may be on a later semantic pass that the error occurs, I'm 
> not sure. Only thing I can think of.
>
>> 
>> However it seems like it doesn't do that, but as I can't 
>> reproduce it I'm just wondering what causes it.
>> 
>> I'm suspecting that it's something to do with dub and that 
>> it's within a dependency that's compiled as a source library, 
>> but I've yet to test it out completely.
>
> Try verbose output maybe?
>
>> 
>> It's really impossible to debug mixins when you have no idea 
>> which mixin the error actually come from, which is what I'm 
>> trying to solve.
>
> You may want to try using __traits(compiles) in a debug version 
> to see whether it will compile or not, and if not, print the 
> thing you are trying to compile.
>
> -Steve

I tried to use __traits(compiles) but it always returns false for 
the code I'm going to mixin, even though it's valid, that was my 
initial go to, so this is really a second attempt on something to 
give meaningful error messages when certain mixins don't compile.



More information about the Digitalmars-d-learn mailing list