D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 1870 - Reproduce offending lines in error messages for string mixins
Summary: Reproduce offending lines in error messages for string mixins
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 All
: P3 enhancement
Assignee: No Owner
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2008-02-26 09:27 UTC by Neia Neutuladh
Modified: 2018-11-07 01:39 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Neia Neutuladh 2008-02-26 09:27:45 UTC
When complaining about something, some compilers reproduce the offending lines. Usually this is not such a big deal, since you have a line number. In D, though, mixins mean that you don't have a line number. In this case, DMD should output the offending lines, since mixins are otherwise difficult to debug (the usual workaround is to output the value with a pragma, pipe to a file, and compile that for the actual error message, but that has mixed success).
Comment 1 Bill Baxter 2008-02-26 12:00:29 UTC
I think you're probably talking about string mixins here?
Summary edited to say that.
Comment 2 Trass3r 2012-01-06 06:00:01 UTC
Yep we really need this.
Comment 3 Andrej Mitrovic 2014-04-27 11:20:26 UTC
Something seems to be outputted nowadays:

-----
string get()
{
    return
"int x;
int y;
int z = x + b;";
}

void main()
{
    mixin(get());
}
-----

test.d-mixin-13(15): Error: undefined identifier b

The only problem is, where is "test.d-mixin-13"?
Comment 4 github-bugzilla 2018-11-07 01:39:27 UTC
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/3bbb228f3f1239058e4451946554b174dd0a85e1
Fix issues 1870 and 12790: Write out string mixin code to a file for debugging purpose

https://github.com/dlang/dmd/commit/34db7419c8bbf7487ecd8e7a4eb6adb6fc0bbb74
Merge pull request #8677 from thewilsonator/mixin-debug

Fix issues 1870 and 12790: Write out string mixin code to a file for debugging purpose