Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6676 from RazvanN7/Deprecate_Issue_15896
Deprecate use of private variables from other modules merged-on-behalf-of: unknown
- Loading branch information
Showing
4 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 @@ | ||
Deprecate the use of selectively imported private members | ||
|
||
$(LINK2 $(ROOT_DIR)spec/attribute.html#visibility_attributes, The specification states) that a private member | ||
is visible only from within the same module. | ||
Prior to this release, due to a bug, private members | ||
were visible through selective imports from other modules, violating the specification. | ||
Beginning with this release, accessing private members from outside the module | ||
in which they are declared will result in a deprecation message. |
This file contains 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 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,18 @@ | ||
// PERMUTE_ARGS: | ||
// REQUIRED_ARGS: -de | ||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/fail15896.d(11): Deprecation: module `imports.imp15896` member `thebar` is not visible from module `fail15896` | ||
fail_compilation/fail15896.d(11): Deprecation: module `imports.imp15896` member `packagebar` is not visible from module `fail15896` | ||
--- | ||
*/ | ||
|
||
import imports.imp15896 : thebar, packagebar; | ||
|
||
int func() | ||
{ | ||
thebar +=1; | ||
packagebar += 1; | ||
return 0; | ||
} |
This file contains 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,4 @@ | ||
module imports.imp15896; | ||
|
||
private int thebar=4; | ||
package int packagebar=3; |