Bug 17184 – error should show import chain leading to (first) problemic file

Status
NEW
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
All
Creation time
2017-02-15T07:25:24Z
Last change time
2024-12-13T18:51:37Z
Assigned to
No Owner
Creator
Timothee Cour
Moved to GitHub: dmd#17789 →

Comments

Comment #0 by timothee.cour2 — 2017-02-15T07:25:24Z
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
Comment #1 by robert.schadek — 2024-12-13T18:51:37Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17789 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB