[Issue 17067] New: D header file generation includes excess imports
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat Jan 7 11:43:32 PST 2017
https://issues.dlang.org/show_bug.cgi?id=17067
Issue ID: 17067
Summary: D header file generation includes excess imports
Product: D
Version: D2
Hardware: x86_64
OS: Windows
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: dhasenan at gmail.com
Consider the following module:
---
import std.stdio;
class Foo
{
void bar()
{
writeln("Hello world!");
}
}
---
While it includes a top-level import, that import isn't used in any of its
declarations.
dmd -H produces:
---
// D import file generated from 'ditest.d'
import std.stdio;
class Foo
{
void bar();
}
---
The unneeded import is retained.
Thanks to Peaker on IRC for pointing this out -- apparently they have a project
that takes many minutes to compile, but, aside from excessive import costs,
incremental builds can finish within a couple seconds.
As an aside, it would be relatively straightforward to map all imports to
static imports in .di files, which would achieve significant savings if we made
static imports lazy.
--
More information about the Digitalmars-d-bugs
mailing list