Bug 9405 – __traits(parent) returns current module as imported package parent
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-01-26T08:47:00Z
Last change time
2013-01-26T11:49:42Z
Assigned to
nobody
Creator
public
Comments
Comment #0 by public — 2013-01-26T08:47:43Z
version(1)
{
import std.traits;
import core.sync.barrier;
}
void main()
{
version(2)
{
import std.traits;
import core.sync.barrier;
}
pragma(msg, __traits(parent, std));
pragma(msg, __traits(parent, core));
}
--------------------------------------
mist@microfog:~/Documents/devel/playground$ dmd -o- -unittest -version=1 test.d
module test
module test
mist@microfog:~/Documents/devel/playground$ dmd -o- -unittest -version=2 test.d
test.d(14): Error: argument std has no parent
false
test.d(15): Error: argument core has no parent
false
--------------------------------------
I am not 100% sure it is a bug, but difference in behavior between global and scoped import + silence in docs on this matter makes me think so.
This is a reason std.traits unittest fail to me when I invoke them directly via:
dmd -o- -unittest std/traits.d
Comment #1 by andrej.mitrovich — 2013-01-26T10:02:19Z
*** This issue has been marked as a duplicate of issue 8922 ***
Comment #2 by public — 2013-01-26T11:49:42Z
Ah, so stupid from my side, checked for "parent"+"package" but only on open ones.
I need to trust more in bug fixing speed :)
Thanks.