[Issue 18488] New: 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 09:50:47 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18488
Issue ID: 18488
Summary: test_extractor misses version(unittest) blocks,
causing `Deprecation: X is not visible from Y`
Product: D
Version: D2
Hardware: x86
OS: Mac OS X
Status: NEW
Severity: normal
Priority: P1
Component: tools
Assignee: nobody at puremagic.com
Reporter: timothee.cour2 at gmail.com
eg:
occurred in https://github.com/dlang/phobos/pull/6178
```
module bar;
vesion(unittest){
void foo(){}
}
unittest{
foo;
}
```
Deprecation: foo is not visible from bar
The solution would be for test_extractor to export `vesion(unittest)`
declarations.
This would be easy to do if
https://github.com/dlang-community/libdparse/issues/191 (Add precise source
locations (start and end) to each ASTNode #191) was fixed (at least for
declarations)
the change would be something like:
```
override void visit(const Declaration decl){
auto u2=decl.conditionalDeclaration;
if(!u2) return;
auto u3=u2.compileCondition.versionCondition;
if(!u3) return;
auto token=u3.token;
import dparse.lexer:tok;
if(token.type!=tok!"unittest") return;
foreach(ui;u2.trueDeclarations){
print(ui); // this would need to access start and end locations of
decl
}
}
```
--
More information about the Digitalmars-d-bugs
mailing list