Bug 9986 – ModuleInfo.importedModules doesn't work

Status
RESOLVED
Resolution
WONTFIX
Severity
normal
Priority
P2
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-04-24T20:07:04Z
Last change time
2022-11-16T04:37:42Z
Assigned to
No Owner
Creator
Timothee Cour

Comments

Comment #0 by timothee.cour2 — 2013-04-24T20:07:04Z
running this gives ["std.stdio"] instead of: ["std.stdio", "std.algorithm", "std.traits"] Is that intended? bug? also it's in fact in ModuleInfo.Old so is that deprecated? If so it should be marked as such. How else to get same functionality? ---- module bugs.bug_2013_04_24_19_55_21; import std.algorithm; import std.stdio; import std.traits; void main(){ foreach(a; ModuleInfo) { if(a.name!=moduleName!a) continue; auto b=a.importedModules; writeln(b.map!`a.name`); } } ----
Comment #1 by stanislav.blinov — 2018-11-24T09:24:39Z
Up to 2.062 : Success with output: ["std.stdio"] 2.063 to 2.064 : Success with output: ["std.algorithm", "std.stdio", "std.traits"] 2.065.0: Success with output: ["std.stdio"] 2.066.0: Success with output: ["std.algorithm", "std.stdio", "std.traits"] 2.067.1 to 2.074.1: Success with output: ["std.stdio"] Since 2.075.1: Success with output: [] Regression?..
Comment #2 by alphaglosined — 2022-11-16T04:37:42Z
importedModules is emitted based upon need. It is used for module constructors being called in the right order. The output right now is: ``` ["std.array", "core.memory", "core.internal.array.utils"] ``` Unfortunately, you cannot use this for reflection purposes, as ModuleInfo is not always emitted (its bloat usually).