www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23673] New: import dependencies should identify how they were

https://issues.dlang.org/show_bug.cgi?id=23673

          Issue ID: 23673
           Summary: import dependencies should identify how they were
                    imported
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: schveiguy gmail.com

When you get a circular dependency error, you receive a printout of the cycle
for the dependencies, something like:

a->b->c->a

which shows the import graph of why the cycle occurred.

However, this doesn't tell you how each dependency was imported. The compiler
could easily store the file/line that caused an import to be added as a
dependency, which would further help identify how the cycle happened.

Sometimes, when instantiating a template, you have an import you don't even see
in a module. So knowing that a imported b because a template in x had an import
of b, and a instantiated that template would go a long way to lower confusion.

This might not be something to do in normal builds, but maybe in debug builds?
Or maybe with a switch to store extra dependency info?

--
Feb 06 2023