Bug 1870 – Reproduce offending lines in error messages for string mixins

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86
OS
All
Creation time
2008-02-26T09:27:45Z
Last change time
2018-11-07T01:39:30Z
Keywords
diagnostic
Assigned to
No Owner
Creator
Neia Neutuladh

Comments

Comment #0 by dhasenan — 2008-02-26T09:27:45Z
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 by wbaxter — 2008-02-26T12:00:29Z
I think you're probably talking about string mixins here? Summary edited to say that.
Comment #2 by hoganmeier — 2012-01-06T06:00:01Z
Yep we really need this.
Comment #3 by andrej.mitrovich — 2014-04-27T11:20:26Z
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 by github-bugzilla — 2018-11-07T01:39:27Z
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