Bug 21238 – -deps considers only the first instantiation site of a template for dependencies
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-09-11T21:38:47Z
Last change time
2021-06-16T10:22:50Z
Keywords
pull
Assigned to
No Owner
Creator
ag0aep6g
Comments
Comment #0 by ag0aep6g — 2020-09-11T21:38:47Z
Related forum thread: https://forum.dlang.org/post/[email protected]
This regression was introduced by the fix for issue 9948.
Consider these four modules:
--- foo.d
import baz;
alias x = t!();
--- bar.d
import baz;
alias x = t!();
--- baz.d
template t() { import qux; }
--- qux.d
// empty
`-deps` should show dependency paths going from foo and bar to qux, either directly or via baz.
`dmd2.063 -o- -deps=>(cat) foo.d bar.d | grep -v druntime` prints (excerpt):
foo (foo.d) : private : baz (baz.d)
baz (baz.d) : private : qux (qux.d)
bar (bar.d) : private : baz (baz.d)
I.e., it shows the expected paths (via baz).
Since 2.064, the same command prints:
foo (foo.d) : private : baz (baz.d)
foo (foo.d) : private : qux (qux.d)
bar (bar.d) : private : baz (baz.d)
Note that it shows a direct edge from foo to qux (which is ok), but no path from bar to qux (neither direct, nor via baz).
The same thing happens with other kinds of dependencies: `import("qux")`, `version (qux) {}`, `pragma(lib, "qux")`.
Possible fixes:
1) revert to the behavior of 2.063, or
2) fix -deps to also print a direct edge from bar to qux.
Comment #1 by dlang-bot — 2020-09-11T21:57:29Z
@aG0aep6G created dlang/dmd pull request #11723 "fix issue 21238 - -deps considers only the first instantiation site of a template for dependencies" fixing this issue:
- fix issue 21238 - -deps considers only the first instantiation site of a template for dependencies
Reopens issue 9948 ("deps dependency printing incorrect for templates"),
because the fix for that issue did more harm than good.
https://github.com/dlang/dmd/pull/11723
Comment #2 by dlang-bot — 2021-06-16T10:22:50Z
dlang/dmd pull request #11723 "fix issue 21238 - -deps considers only the first instantiation site of a template for dependencies" was merged into master:
- 4d51b33b465747a216b9db3cf674766fc5da24aa by aG0aep6G:
fix issue 21238 - -deps considers only the first instantiation site of a template for dependencies
Reopens issue 9948 ("deps dependency printing incorrect for templates"),
because the fix for that issue did more harm than good.
https://github.com/dlang/dmd/pull/11723