fix Issue 314 - static, renamed, and selective imports are always public#5485
fix Issue 314 - static, renamed, and selective imports are always public#5485WalterBright merged 1 commit intodlang:masterfrom
Conversation
|
|
Can this be done as smaller PRs? These giant things are very hard to review. For example, the first commit is a simple refactor, there's no need to lump it in with the rest. Queue all the arguments I made to Kenji about this. |
This PR is based on DIP22 (#5472) as mentioned above, so github shows commits from both. |
|
If the previous commits are already pulled, why do they show here? I don't understand. Maybe rebase? |
|
@WalterBright : They aren't pulled yet, #5472 is still open. |
|
Rebased now and also added a changelog entry @WalterBright. |
| AliasDeclaration ad = void; | ||
| // accessing private selective and renamed imports is | ||
| // deprecated by restricting the symbol visibility | ||
| if (s.isImport() || (ad = s.isAliasDeclaration()) !is null && ad._import !is null) |
There was a problem hiding this comment.
The eager access checks during lookup are disabled for renamed and selective imports. This is instead handled by the new DIP22 symbolIsVisible check above.
This means that people will only get a deprecation warning for now (b/c of the additional IgnoreSymbolVisibility lookup), and that -transition=import/-transition=checkimports work as for any other private symbol w/ the DIP22 changes.
|
Fixed the Win64 failure, see #5509. |
- enable protection for imports (unless -transition=import or -transition=checkimports is used) - relies on DIP22 in order to resolve public/private symbol conflicts hence cannot be enabled when DIP22 is turned off by the transition switches
|
Rebased on top of the merged BitArray bugfix. The Win32_64 is a bit overwhelmed, can we get this auto-merged once it's reviewed? |
|
Guess it's about time. As I mentioned in email comm, it would be great to integrate all lookup changes under the same scalable -dip22 flag. @MartinNowak @WalterBright thoughts? |
|
Auto-merge toggled on |
fix Issue 314 - static, renamed, and selective imports are always public
The can all be turned off/mitigated using -transition=imports/-transition=checkimports. DIP22, 313, and 314 are all implemented as deprecations and shouldn't change the semantic of any currently compiling code. |
|
Does this mean we can finally get rid of the complete imports of modules at the top of every Phobos file? |
It means you can safely add selective imports add module level, w/o leaking symbols. Don't jump onto that too fast until the deprecation is over and we remove the |
Based on DIP22 (#5472) in order to resolve plenty of private/public symbol collisions as in this example.
Depends On: #5509