-
-
Notifications
You must be signed in to change notification settings - Fork 683
Fix Issue 18219 - Private import inside struct leaks symbols when used as VarDeclaration types #7668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Fix Issue 18219 - Private import inside struct leaks symbols when used as VarDeclaration types #7668
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9bcb80a
Fix Issue 18219 - Private import inside struct leaks symbols when use…
RazvanN7 580c475
Add ddoc style section for searchX
RazvanN7 039cdf1
Fix symbol lookup to find public imports nested by structs
RazvanN7 6d25a08
Transform error into a deprecation message
RazvanN7 6decb34
Add changelog entry
RazvanN7 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| Fix Issue 18219 - Private import inside struct leaks symbols when used as VarDeclaration types | ||
|
|
||
| When implementing a struct which has a local private import | ||
| the imported symbols are leaked if present in a VarDeclaration statement. For more information and examples see : https://issues.dlang.org/show_bug.cgi?id=18219 | ||
|
|
||
| Symbols from the private import should not visible outside the | ||
| struct scope. A deprecation is now issued when such cases are | ||
| encountered |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| // EXTRA_SOURCES: imports/b18219.d | ||
| /* | ||
| TEST_OUTPUT: | ||
| --- | ||
| fail_compilation/fail18219.d(15): Deprecation: `b18219.Foobar` is not visible from module `fail18219` | ||
| fail_compilation/fail18219.d(16): Error: no property `Bar` for type `AST` | ||
| fail_compilation/fail18219.d(17): Error: no property `fun` for type `AST`, did you mean `b18219.fun`? | ||
| fail_compilation/fail18219.d(18): Error: no property `Foobar` for type `AST`, did you mean `b18219.Foobar`? | ||
| --- | ||
| */ | ||
| import imports.a18219; | ||
|
|
||
| void main() | ||
| { | ||
| AST.Foobar t; | ||
| AST.Bar l; | ||
| AST.fun(); | ||
| AST.Foobar.smeth(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| module a18219; | ||
|
|
||
| struct AST | ||
| { | ||
| import b18219; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| module b18219; | ||
|
|
||
| class Foobar | ||
| { | ||
| int a; | ||
| this(int a) | ||
| { | ||
| this.a = a; | ||
| } | ||
| static int smeth() | ||
| { | ||
| return 1; | ||
| } | ||
| } | ||
| void fun() {} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add
ParamsDDoc comment.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normally DAutotest should check that and fail respectively (except that we broke it today - #7637)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, yes. Though I'm looking forward to replacing
flagswith a properenum. But that's another PR.