digitalmars.D.bugs - [Issue 16265] New: unittest imports should not be counted as
- via Digitalmars-d-bugs (30/30) Jul 11 2016 https://issues.dlang.org/show_bug.cgi?id=16265
https://issues.dlang.org/show_bug.cgi?id=16265 Issue ID: 16265 Summary: unittest imports should not be counted as dependencies for static ctors Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: schveiguy yahoo.com A module like this: shared static this() {...} unittest { import other; // other imports this module, and contains static ctors other.foo(); } Should not be considered a cycle. The shared ctor cannot possibly call the unit test code, so there is no leaking of the import. The only place static ctors can exist inside a unittest is in a local class or struct. We can easily detect this and allow the dependency based on that. This allows things like examples and other useful mechanisms, to be located in the right module, without causing frivolous cycles. I've had to fix several such "cycles" in phobos recently. The easiest way to fix this is to simply not emit the dependency into the module info in such a case. --
Jul 11 2016