[Issue 12790] New: Compiler should keep mixin file around for debugging purposes

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri May 23 08:01:20 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=12790

          Issue ID: 12790
           Summary: Compiler should keep mixin file around for debugging
                    purposes
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: andrej.mitrovich at gmail.com

Possibly duplicate report, but I want to discuss this:

-----
string someCode()
{
    return "
    int x;
    int y = a; // bug
    ";
}

mixin(someCode());

void main() { }  // L11
-----

2.064.2:
$ dmd test.d
> test.d(11): Error: undefined identifier a, did you mean variable x?

2.065:
$ dmd test.d
> test.d-mixin-9(11): Error: undefined identifier a

I assume this was changed in order to avoid using confusing error line numbers
in the original file (L11 is not really appropriate for any tooling support in
2.064.2).

However, this change still isn't helpful because we do not **have** the
'test.d-mixin-9' file. Is it stored on disk somewhere and then promptly
deleted? Or is the diagnostic just faking by saying there's a 'test.d-mixin-9'
file?

I think the compiler should actually create this file (maybe in a temporary
dir), and then users will be able to instantly jump-to the point of the mixin
where there is some invalid code. 

This would avoid having to inject pragma(msg) statements.

--


More information about the Digitalmars-d-bugs mailing list