Thread overview
[Issue 20072] [2.087.0] Mixin templates: no property `somevar` for type `some.Type`, did you mean `some.Type.__anonymous.somevar`?
Jul 22, 2019
Ethan Watson
Jul 23, 2019
Ethan Watson
Jul 23, 2019
Simen Kjaeraas
Jul 24, 2019
ZombineDev
Jul 24, 2019
ZombineDev
Aug 01, 2019
Ethan Watson
July 22, 2019
https://issues.dlang.org/show_bug.cgi?id=20072

--- Comment #1 from Ethan Watson <gooberman@gmail.com> ---
Turned on deprecations as warnings in 2.086.1. Looks like this stuff has been broken for a while.

For example:

Deprecation: `smithy.editor.server.Server.__anonymous.m_registry` is not visible from module `smithy.editor.common.behaviors.registry`

It is mixed in to smithy.editor.server.Server with a template like this:

mixin template Registry()
{
        package( smithy.editor ) SmithyObjectRegistry   m_registry;
}

And just to make sure, the function that tries to access m_registry does something like this:

module smithy.editor.common.behaviors.registry;
package( smithy ) auto createImpl( ServerType, Params... )( ServerType server,
Params params )
{
        import std.traits : moduleName;
        mixin( "import " ~ moduleName!ServerType ~ ";" );
        // Rest of code follows here...
}

Basically, there's no way that m_registry shouldn't be visible at this point.

--
July 23, 2019
https://issues.dlang.org/show_bug.cgi?id=20072

Ethan Watson <gooberman@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|regression                  |blocker

--- Comment #2 from Ethan Watson <gooberman@gmail.com> ---
It's a static foreach problem.

For whatever reason, static foreach is inserting that __anonymous scope. And generic code cannot deal with it. __traits( parent ) errors for example.

Example code follows:


import std.meta : AliasSeq;
import std.traits : moduleName;

string generateFor( string objectName )()
{
    return "struct " ~ objectName ~ "{ }";
}

alias StructNames = AliasSeq!( "StructOne", "StructTwo", "StructThree" );

static foreach( Name; StructNames )
{
    mixin( generateFor!Name );
}

pragma( msg, moduleName!StructOne );

--
July 23, 2019
https://issues.dlang.org/show_bug.cgi?id=20072

Simen Kjaeraas <simen.kjaras@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simen.kjaras@gmail.com

--- Comment #3 from Simen Kjaeraas <simen.kjaras@gmail.com> ---
Further reduction:

static foreach( Name; 0..1 )
     mixin( "struct S { }" );

//  Error: local scope __anonymous is not a variable
pragma(msg, __traits(parent, S));

--
July 24, 2019
https://issues.dlang.org/show_bug.cgi?id=20072

ZombineDev <petar.p.kirov@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |petar.p.kirov@gmail.com
         Resolution|---                         |FIXED

--- Comment #4 from ZombineDev <petar.p.kirov@gmail.com> ---
Fixed by https://github.com/dlang/dmd/pull/10214

--
July 24, 2019
https://issues.dlang.org/show_bug.cgi?id=20072

ZombineDev <petar.p.kirov@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Hardware|x86                         |All
                 OS|Windows                     |All

--
August 01, 2019
https://issues.dlang.org/show_bug.cgi?id=20072

--- Comment #5 from Ethan Watson <gooberman@gmail.com> ---
Confirmed that this fixes my static foreach woes

--