Bug 18625 – mixin(__MODULE__) in string mixin results in undefined identifier in certain cases
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-03-17T21:55:53Z
Last change time
2024-07-15T12:52:55Z
Assigned to
No Owner
Creator
elpenguino+D
Comments
Comment #0 by elpenguino+D — 2018-03-17T21:55:53Z
This works:
```
module asdf;
mixin(`static assert(mixin(__MODULE__).stringof == "module "~__MODULE__);`);
```
This does not work:
```
module y.asdf;
mixin(`static assert(mixin(__MODULE__).stringof == "module "~__MODULE__);`);
```
Comment #1 by ag0aep6g — 2018-03-17T22:20:46Z
Reduced:
----
module y.asdf;
pragma(msg, __MODULE__); /* y.asdf */
pragma(msg, mixin("__MODULE__")); /* asdf */
----
Both lines should print "y.asdf".
Comment #2 by destructionator — 2022-11-30T22:08:48Z
general problem here is the compiler likes to pretend modules have one name and are part of a package instead of just being a thing that has multiple parts separated by dots in the one thing. so painful, module reflection needs work
Comment #3 by qs.il.paperinik — 2024-07-15T12:52:55Z