{"action":"created","issue":{"url":"https://api.github.com/repos/D-Programming-Language/dmd/issues/5445","repository_url":"https://api.github.com/repos/D-Programming-Language/dmd","labels_url":"https://api.github.com/repos/D-Programming-Language/dmd/issues/5445/labels{/name}","comments_url":"https://api.github.com/repos/D-Programming-Language/dmd/issues/5445/comments","events_url":"https://api.github.com/repos/D-Programming-Language/dmd/issues/5445/events","html_url":"https://github.com/D-Programming-Language/dmd/pull/5445","id":133166121,"number":5445,"title":"fix Issue 10378 - Local imports hide local symbols","user":{"login":"WalterBright","id":568298,"avatar_url":"https://avatars.githubusercontent.com/u/568298?v=3","gravatar_id":"","url":"https://api.github.com/users/WalterBright","html_url":"https://github.com/WalterBright","followers_url":"https://api.github.com/users/WalterBright/followers","following_url":"https://api.github.com/users/WalterBright/following{/other_user}","gists_url":"https://api.github.com/users/WalterBright/gists{/gist_id}","starred_url":"https://api.github.com/users/WalterBright/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WalterBright/subscriptions","organizations_url":"https://api.github.com/users/WalterBright/orgs","repos_url":"https://api.github.com/users/WalterBright/repos","events_url":"https://api.github.com/users/WalterBright/events{/privacy}","received_events_url":"https://api.github.com/users/WalterBright/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/D-Programming-Language/dmd/milestones/10","html_url":"https://github.com/D-Programming-Language/dmd/milestones/2.071.0","labels_url":"https://api.github.com/repos/D-Programming-Language/dmd/milestones/10/labels","id":1559190,"number":10,"title":"2.071.0","description":null,"creator":{"login":"MartinNowak","id":288976,"avatar_url":"https://avatars.githubusercontent.com/u/288976?v=3","gravatar_id":"","url":"https://api.github.com/users/MartinNowak","html_url":"https://github.com/MartinNowak","followers_url":"https://api.github.com/users/MartinNowak/followers","following_url":"https://api.github.com/users/MartinNowak/following{/other_user}","gists_url":"https://api.github.com/users/MartinNowak/gists{/gist_id}","starred_url":"https://api.github.com/users/MartinNowak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MartinNowak/subscriptions","organizations_url":"https://api.github.com/users/MartinNowak/orgs","repos_url":"https://api.github.com/users/MartinNowak/repos","events_url":"https://api.github.com/users/MartinNowak/events{/privacy}","received_events_url":"https://api.github.com/users/MartinNowak/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":1,"state":"open","created_at":"2016-02-02T17:31:15Z","updated_at":"2016-02-16T22:52:25Z","due_on":"2016-03-27T00:00:00Z","closed_at":null},"comments":100,"created_at":"2016-02-12T06:17:47Z","updated_at":"2016-02-17T03:27:01Z","closed_at":"2016-02-16T22:52:25Z","pull_request":{"url":"https://api.github.com/repos/D-Programming-Language/dmd/pulls/5445","html_url":"https://github.com/D-Programming-Language/dmd/pull/5445","diff_url":"https://github.com/D-Programming-Language/dmd/pull/5445.diff","patch_url":"https://github.com/D-Programming-Language/dmd/pull/5445.patch"},"body":"This is a fix of https://issues.dlang.org/show_bug.cgi?id=10378 and a reboot of https://github.com/D-Programming-Language/dmd/pull/4915\r\n\r\nIt requires https://github.com/D-Programming-Language/phobos/pull/3989\r\n\r\nThis version is based on a comment Andrei made to me a long time ago about it. Symbol lookup is now done in two passes (formerly one). The first pass goes up through the scopes, checking everything but imported modules. If that fails, the scopes are gone through again, checking only imported modules.\r\n\r\nThis algorithm:\r\n\r\n1. retains the scoped nature of nested imports, i.e. names in nested imports **will hide** outer imported names\r\n2. works the same for function locals as it does for struct members, which was my complaint about #4915 \r\n3. does not issue errors for shadowing - it simply finds the shadowed symbol first.\r\n4. **breaks existing code**. Turns out that people did rely on it. See https://github.com/D-Programming-Language/phobos/pull/3989\r\n5. is pretty simple. (the large number of lines of code changed is mostly due to debugging and printing code which I'll remove once it passes the autotester\r\n6. exposed a bug in the way the compiler is implemented, see https://github.com/D-Programming-Language/phobos/pull/3989 for that, too. I'm sure there'll be other instances in the wild of this.\r\n7. it should only be a hair slower, as it never looks in the same hash table twice"},"comment":{"url":"https://api.github.com/repos/D-Programming-Language/dmd/issues/comments/184998020","html_url":"https://github.com/D-Programming-Language/dmd/pull/5445#issuecomment-184998020","issue_url":"https://api.github.com/repos/D-Programming-Language/dmd/issues/5445","id":184998020,"user":{"login":"schveiguy","id":580778,"avatar_url":"https://avatars.githubusercontent.com/u/580778?v=3","gravatar_id":"","url":"https://api.github.com/users/schveiguy","html_url":"https://github.com/schveiguy","followers_url":"https://api.github.com/users/schveiguy/followers","following_url":"https://api.github.com/users/schveiguy/following{/other_user}","gists_url":"https://api.github.com/users/schveiguy/gists{/gist_id}","starred_url":"https://api.github.com/users/schveiguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schveiguy/subscriptions","organizations_url":"https://api.github.com/users/schveiguy/orgs","repos_url":"https://api.github.com/users/schveiguy/repos","events_url":"https://api.github.com/users/schveiguy/events{/privacy}","received_events_url":"https://api.github.com/users/schveiguy/received_events","type":"User","site_admin":false},"created_at":"2016-02-17T03:27:01Z","updated_at":"2016-02-17T03:27:01Z","body":"> our second example now outputs b with this PR\r\n\r\nOh right! I wasn't thinking about the fact that local module functions aren't actually imported :)\r\n\r\nSo no need to reimport the current module if the current module's function is what you want. This is great! Thanks."}}