[Issue 10378] Local imports hide local symbols

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Aug 21 02:38:29 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=10378

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|nobody at puremagic.com        |k.hara.pg at gmail.com

--- Comment #14 from Kenji Hara <k.hara.pg at gmail.com> ---
We can resolve the issue by applying some rewriting rule.

void test()
{
    import a, b;
    import c;

    stmt1;

    improt d;

    stmt2;
}

To:

void test()
{
    struct __ImportScope1 {     // internal namespace
        import a, b;
        import c;
    }
    with (__ImportScope1) {
        stmt1;

        struct __ImportScope2 {     // internal namespace
            improt d;
        }
        with (__ImportScope2) {
            stmt2;
        }
    }
}

After that, we can reuse the symbol shadowing check mechanism on WithStatement.

--


More information about the Digitalmars-d-bugs mailing list