[Issue 16265] unittest imports should not be counted as dependencies for static ctors
https://issues.dlang.org/show_bug.cgi?id=16265 --- Comment #1 from anonymous4 --- But you will still have a cycle when compiling unittests? Then unittest dependencies can't be possibly ignored. --
[Issue 16265] unittest imports should not be counted as dependencies for static ctors
https://issues.dlang.org/show_bug.cgi?id=16265 Steven Schveighoffer 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 --- 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. --
[Issue 16265] unittest imports should not be counted as dependencies for static ctors
https://issues.dlang.org/show_bug.cgi?id=16265 anonymous4 changed: What|Removed |Added See Also||https://issues.dlang.org/sh ||ow_bug.cgi?id=16673 --
[Issue 16265] unittest imports should not be counted as dependencies for static ctors
https://issues.dlang.org/show_bug.cgi?id=16265 --- Comment #4 from Steven Schveighoffer --- Trial PR: https://github.com/dlang/dmd/pull/6753 --
[Issue 16265] unittest imports should not be counted as dependencies for static ctors
https://issues.dlang.org/show_bug.cgi?id=16265 Mike Franklin changed: What|Removed |Added CC||slavo5...@yahoo.com --- Comment #5 from Mike Franklin --- I think it would help to have an example that someone could quickly cut and paste into their development environment to reproduce and illustrate the problem. --
[Issue 16265] unittest imports should not be counted as dependencies for static ctors
https://issues.dlang.org/show_bug.cgi?id=16265 --- Comment #6 from Steven Schveighoffer --- (In reply to Mike Franklin from comment #5) > I think it would help to have an example that someone could quickly cut and > paste into their development environment to reproduce and illustrate the > problem. Of course. It's going to be a toy example, but things like documented unit tests cause these kinds of problems, especially when you have so many modules that you need stuff from in order to run a complete program. mod1.d: module mod1; immutable int val; shared static this() { val = 2; } size_t bar(size_t x) { return x + 1; } unittest { import mod2; assert("abc".foo.bar == 7); } mod2.d: module mod2; import mod1; immutable int multiplier; shared static this() { multiplier = val; } size_t foo(string s) { return s.length * multiplier; } --
[Issue 16265] unittest imports should not be counted as dependencies for static ctors
https://issues.dlang.org/show_bug.cgi?id=16265 Iain Buclaw changed: What|Removed |Added Priority|P1 |P4 --