Bug 23673 – import dependencies should identify how they were imported

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2023-02-06T20:02:16Z
Last change time
2024-12-13T19:27:07Z
Assigned to
No Owner
Creator
Steven Schveighoffer
Moved to GitHub: dmd#20226 →

Comments

Comment #0 by schveiguy — 2023-02-06T20:02:16Z
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?
Comment #1 by robert.schadek — 2024-12-13T19:27:07Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20226 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB