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

Steven Schveighoffer <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|batter detection of real    |unittest imports should not
                   |module cycles               |be counted as dependencies
                   |                            |for static ctors

--- Comment #3 from Steven Schveighoffer <[email protected]> ---
unittest dependencies cannot be called directly by static constructors (except
by Martin's corner case method), so their imports don't count when doing
construction. By the time unittests run, static ctors are already done, so no
worries there.

(In reply to Martin Nowak from comment #2
> 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.

I disagree this is not far-fetched, do we need to screw up everyone's cycle
detection code due to this rare case? Isn't it enough to just say "WARNING unit
test imports are not considered during static construction, calling unit tests
during static construction can result in undetected cycles"?

Consider that documented unit tests are meant to show how one can use a library
call, and this might involve importing many other modules that are totally
unrelated. Including unittest imports when doing cycle detection is harmful in
many ways, it is very advantageous to get rid of this.

Please, open a new bug report for other ideas of cycle detection improvement,
don't override the purpose of this one.

--

Reply via email to