D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 17683 - __traits compiles does not work with package.d
Summary: __traits compiles does not work with package.d
Status: RESOLVED DUPLICATE of issue 11847
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-25 11:45 UTC by Andre
Modified: 2017-07-26 09:54 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andre 2017-07-25 11:45:02 UTC
File m1.d
---------------------------------------

module m1;

import sub;

void main()
{
  import std.traits: fullyQualifiedName;
  mixin(`static assert(__traits(compiles, `~fullyQualifiedName!Bar~`.bar));`);
}


File sub/m2.d
---------------------------------------

module sub.m2;

class Bar
{
	int bar;
}


File sub/package.d
---------------------------------------
module sub;

public import sub.m2;


PS C:\Users\user\Desktop\source> dmd -run m1.d sub/package.d sub/m2.d
m1.d-mixin-9(9): Error: static assert  __traits(compiles, sub.m2.Bar.bar) is false

While fullyQualifiedName is able to find the symbol Bar, __traits compiles does not find it. It works if I replace the package.d import with the specific module m2.d import

Version: DMD32 D Compiler v2.075.0-rc1-master-af3eacf on Windows 10
Comment 1 Vladimir Panteleev 2017-07-26 09:54:35 UTC
Nothing to do with __traits(compiles).

fullyQualifiedName!Bar expands to "sub.m2.Bar".

That fully qualified names don't work with package modules is issue 11847.

*** This issue has been marked as a duplicate of issue 11847 ***