[Issue 16265] batter detection of real module cycles

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Oct 4 14:42:25 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=16265

Martin Nowak <code at dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |code at dawg.eu
            Summary|unittest imports should not |batter detection of real
                   |be counted as dependencies  |module cycles
                   |for static ctors            |

--- Comment #2 from Martin Nowak <code at dawg.eu> ---
> 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.

Well, unfortunately it's technically possible using `__traits(getUnitTests,
__MODULE__)`, 
and it wouldn't be too far-fetched to call the tests from a static ctor.
The example is pretty close to do that
http://dlang.org/spec/traits.html#getUnitTests.

--


More information about the Digitalmars-d-bugs mailing list