[Issue 18488] test_extractor misses version(unittest) blocks, causing `Deprecation: X is not visible from Y`

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 22 14:25:35 UTC 2018


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

Seb <greensunny12 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |greensunny12 at gmail.com
         Resolution|---                         |WONTFIX

--- Comment #1 from Seb <greensunny12 at gmail.com> ---
It's not a bug, but a feature.

1) ALL public examples need to be runnable locally and dlang.org
That's not optional, but a deep requirement from mistakes in the past and the
resulting bad image.

2) We don't use version(unittest) for future code and are about to weed out the
last usages in Phobos, because you essentially just ended up with
- accidentally exposing a public symbol
- adding different behavior for -unittest (i.e. the testsuites) - there have
been quite a few bugs where `version(unittest) { import std.stdio;}` led to
bugs in user code because of templates and their dependence on the
version(unittest) imports which obviously wasn't caught by the testsuite.

While I really like your enthusiasm and in general a lot of things in the D
lang are old, same are quite new and have a reason for being there, so
sometimes taking a moment to step back and check why there's a CI warning (and
not directly opening a bug report + finding "workarounds") would save you save
time and frustration.

> The solution would be for test_extractor to export `vesion(unittest)` declarations.

That wouldn't help and you can already do better today with a
ConditionalDeclaration visitor, e.g. in pseudo-code:

---
override void visit(const ConditionalDeclaration decl){
   // if decl is unittest
    auto text = cast(immutable(char)[]) sourceCode[decl.startLocation
decl.endLocation];    
}
---

--


More information about the Digitalmars-d-bugs mailing list