Thread overview
[Issue 17441] std.traits.moduleName gives wrong answer for modules imported under a different name in a mixin
Jan 10, 2020
berni44
Jan 10, 2020
berni44
Jan 11, 2020
berni44
Jan 15, 2020
Boris Carvajal
Jan 15, 2020
Dlang Bot
Jan 19, 2020
Dlang Bot
Feb 07, 2020
Dlang Bot
January 10, 2020
https://issues.dlang.org/show_bug.cgi?id=17441

berni44 <bugzilla@d-ecke.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@d-ecke.de
           Hardware|x86_64                      |All
                 OS|Linux                       |All

--- Comment #1 from berni44 <bugzilla@d-ecke.de> ---
Mixin seems not to matter. Simplified testcase (foo/bar/package.d and
foo/bar/baz.d like above):

void main()
{
    import std.traits : moduleName;

    import mod0 = foo.bar.baz;
    import mod1 = foo.bar;

    assert(moduleName!mod0 == "foo.bar.baz");
    assert(moduleName!mod1 == "foo.bar"); // fails with foo.bar.bar
}

--
January 10, 2020
https://issues.dlang.org/show_bug.cgi?id=17441

--- Comment #2 from berni44 <bugzilla@d-ecke.de> ---
The problem is the call to packageName, not moduleName:

void main()
{
    import std.traits : packageName;

    import mod0 = foo.bar.baz;
    import mod1 = foo.bar;

    assert(packageName!mod0 == "foo.bar"); // comment this line out and it
works
    assert(packageName!mod1 == "foo"); // fails with foo.bar
}

It seems, that the template `packageName` is only instantiated with the first call. For the second, the template parameter seems to be considered the same as before (although it isn't). DMD bug?

--
January 11, 2020
https://issues.dlang.org/show_bug.cgi?id=17441

berni44 <bugzilla@d-ecke.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #3 from berni44 <bugzilla@d-ecke.de> ---


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

--
January 15, 2020
https://issues.dlang.org/show_bug.cgi?id=17441

Boris Carvajal <boris2.9@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |boris2.9@gmail.com
         Resolution|DUPLICATE                   |---

--- Comment #4 from Boris Carvajal <boris2.9@gmail.com> ---
Although similar to issue 14501 this doesn't deal with enums (that seems more
hard to fix).

I have a working solution for the examples except the Atila's last part:

    import foo.bar;
    pragma(msg, foo.bar.stringof); // "package bar"
    import oops = foo.bar;
    pragma(msg, oops.stringof);    // "module bar"

which I think belongs to another bug report.

--
January 15, 2020
https://issues.dlang.org/show_bug.cgi?id=17441

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> ---
@BorisCarvajal created dlang/dmd pull request #10724 "Fix Issue 17441 - Template instantiation reused when arguments are mo…" fixing this issue:

- Fix Issue 17441 - Template instantiation reused when arguments are module and package with same name

https://github.com/dlang/dmd/pull/10724

--
January 19, 2020
https://issues.dlang.org/show_bug.cgi?id=17441

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #10724 "Fix Issue 17441 - Template instantiation reused when arguments are mo…" was merged into stable:

- 909f8db921ac52669c0a2832408b21ca12743112 by Boris Carvajal:
  Fix Issue 17441 - Template instantiation reused when arguments are module and
package with same name

https://github.com/dlang/dmd/pull/10724

--
February 07, 2020
https://issues.dlang.org/show_bug.cgi?id=17441

--- Comment #7 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #10753 "Merge remote-tracking branch 'upstream/stable' into merge_stable" was merged into master:

- b7c279fe6069b73569f781d7dbedb2ff100f546d by Boris Carvajal:
  Fix Issue 17441 - Template instantiation reused when arguments are mo…
(#10724)

  Fix Issue 17441 - Template instantiation reused when arguments are mo…
  merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>

https://github.com/dlang/dmd/pull/10753

--