[Issue 17184] New: error should show import chain leading to (first) problemic file
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Feb 14 23:25:24 PST 2017
https://issues.dlang.org/show_bug.cgi?id=17184
Issue ID: 17184
Summary: error should show import chain leading to (first)
problemic file
Product: D
Version: D2
Hardware: x86
OS: All
Status: NEW
Severity: major
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: timothee.cour2 at gmail.com
TLD: we need an option -show_error_chain to the chain of imports leading to an
error
---
`dmd -c -o- main.d`
produces error:
```
pathto/msgpackrpc/common.d(34): Error: undefined identifier 'Value'...
```
plus other errors all involving files under pathto/msgpack-rpc/
There is no context showing how we got to this file in the 1st place. In large
projects this can be very confusing and hard to track. dmd should show one
chain of paths leading from a file given on command line to the first file that
shows an error, at least as an option (eg: `-show_error_chain`). For remaining
errors, this is not as critical (as user can fix errors one by one).
EG:
```
dmd -show_error_chain ...
Error:
pathto/msgpackrpc/common.d(34): Error: ...
Chain: main.d:2 => fun1.d:2 => fun2.d:2 => pathto/msgpackrpc/package.d:2
```
```
main.d:
import fun1;
fun1.d:
import fun2;
fun2.d:
import msgpackrpc;
pathto/msgpackrpc/package.d:
import msgpackrpc.common;
pathto/msgpackrpc/common.d:
import msgpack; // caused the error because i had another file named that in
`cwd`
```
NOTE: using `dmd -v` helps but not much, because it shows all the files
flattened and we lose the stack, or context that led to the error; if we had
indentation it would help a bit.
NOTE: clang, python have this IIRC
--
More information about the Digitalmars-d-bugs
mailing list