Thread overview
[Issue 15150] [REG2.068.1] Public selective import causes conflict
Oct 04, 2015
Kenji Hara
Oct 05, 2015
Kenji Hara
October 04, 2015
https://issues.dlang.org/show_bug.cgi?id=15150

--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> ---
The direct cause is the change TypeIdentifier.toDsymbol in PR 4918, but the root cause is more deep.

When a symbol identifier is looked up via Dsymbol.search, an EnumMember symbol can be returned.

On the other hand, a TypeIdentifier resolution by using Type.resolve always returns a wrapper VarExp for the EnumMember symbol.

It means that, currently a EnumMember object can be represented by two ways. In the provided test case:

//// c.d ////

import a;
import b;

enum y = x;
 // 1. from module a, ScopeDsymbol.search returns EnumMember('a.x')
 // 2. from module b, ScopeDsymbol.search returns AliasDeclaration('b.x'), and
 //   it's _import field is not null.
 // 2a. In the AliasDeclaration.semantic, its type is TypeIdentifier('x').
 //     Before the PR 4918 change, type.toDsymbol(sc) at line 598 had returned
 //     EnumMember symbol, but after that, the AliasDeclaration is changed to
refer
 //     the wrapper VarDeclaration instead.
 // 3. Then, scopeDsymbol.search will try to create OverloadSet for the
 //    identifier 'x' search, because the imports give two different symbols
 //    (EnuMmember and its wrapper VarDeclaration). But of course it fails, and
 //    the "Error a.x at a.d(1) conflicts with a.x at b.d(1)" is reported.

The wrapper VarDeclaration is introduce in the PR to support UDAs for enum members.

https://github.com/D-Programming-Language/dmd/pull/1960

To fix the "two face of EnumMember" issue, I think EnumMember class should be derived from VarDeclaration.

--
October 05, 2015
https://issues.dlang.org/show_bug.cgi?id=15150

Kenji Hara <k.hara.pg@gmail.com> changed:

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

--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> ---
https://github.com/D-Programming-Language/dmd/pull/5161

--
October 06, 2015
https://issues.dlang.org/show_bug.cgi?id=15150

github-bugzilla@puremagic.com changed:

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

--
October 06, 2015
https://issues.dlang.org/show_bug.cgi?id=15150

--- Comment #3 from github-bugzilla@puremagic.com ---
Commits pushed to stable at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/9e1e61d6e9d7713f8d64def9c468c0771bb6efff fix Issue 15150 - Public selective import causes conflict

By making `EnumMember` to the subclass of `VarDeclaration`, the symbol itself can be representation of the enum member name.

https://github.com/D-Programming-Language/dmd/commit/f8d24cd1796bfe369fcd55feff191b99b96aa094 Merge pull request #5161 from 9rnsr/fix15150

[REG2.068.1] Issue 15150 - Public selective import causes conflict

--
October 07, 2015
https://issues.dlang.org/show_bug.cgi?id=15150

--- Comment #4 from github-bugzilla@puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/9e1e61d6e9d7713f8d64def9c468c0771bb6efff fix Issue 15150 - Public selective import causes conflict

https://github.com/D-Programming-Language/dmd/commit/f8d24cd1796bfe369fcd55feff191b99b96aa094 Merge pull request #5161 from 9rnsr/fix15150

--
August 02, 2017
https://issues.dlang.org/show_bug.cgi?id=15150

--- Comment #5 from github-bugzilla@puremagic.com ---
Commit pushed to dmd-cxx at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/72e863ea02676f4eab27e3df6af6aa98ec99f57b Issue 15150 - Public selective import causes conflict

--