www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17184] New: error should show import chain leading to (first)


          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 puremagic.com
          Reporter: timothee.cour2 gmail.com

TLD: we need an option -show_error_chain to the chain of imports leading to an

`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).

dmd -show_error_chain ...

pathto/msgpackrpc/common.d(34): Error: ...
Chain: main.d:2 => fun1.d:2 => fun2.d:2 => pathto/msgpackrpc/package.d:2

import fun1;

import fun2;

import msgpackrpc;

import msgpackrpc.common;

import msgpack; // caused the error because i had another file named that in

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

Feb 14