Thread overview
[Issue 22889] Selective import shadows local variable
Mar 17, 2022
Basile-z
Mar 17, 2022
Basile-z
Mar 17, 2022
Paul Backus
Dec 17, 2022
Iain Buclaw
Jan 03, 2023
MrSmith33
March 17, 2022
https://issues.dlang.org/show_bug.cgi?id=22889

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |b2.temp@gmx.com

--- Comment #1 from Basile-z <b2.temp@gmx.com> ---
isn't x with 2 as value hidden on purpose ?

--
March 17, 2022
https://issues.dlang.org/show_bug.cgi?id=22889

--- Comment #2 from Basile-z <b2.temp@gmx.com> ---
ah I see the problem now, the x that has 2 for value cant be used anymore. No way to fully qualify it.

--
March 17, 2022
https://issues.dlang.org/show_bug.cgi?id=22889

--- Comment #3 from Paul Backus <snarwin+bugzilla@gmail.com> ---
Note that the following similar program does NOT compile:

--- lib.d
int x = 1;

--- main.d
void main()
{
    int x = 2;
    {
        import lib;
        alias x = lib.x;
        assert(x == 1);
    }
}
---

The error given is

---
main.d(6): Error: alias `x` is shadowing variable `main.main.x`
---

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=22889

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

--
January 03, 2023
https://issues.dlang.org/show_bug.cgi?id=22889

MrSmith33 <mrsmith33@yandex.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mrsmith33@yandex.ru

--