-
-
Notifications
You must be signed in to change notification settings - Fork 609
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 #5426 from MartinNowak/fix313
fix Issue 313 - Fully qualified names bypass private imports
- Loading branch information
Showing
28 changed files
with
311 additions
and
16 deletions.
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
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
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
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
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
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,8 @@ | ||
| module imports.a313; | ||
|
|
||
| // adds private package imports | ||
| private import imports.b313; | ||
| // adds private package core | ||
| private import core.stdc.stdio; | ||
| // adds public alias cstdio | ||
| public alias cstdio = core.stdc.stdio; |
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,7 @@ | ||
| module imports.b313; | ||
|
|
||
| void bug() | ||
| { | ||
| // scope has access to it's own module | ||
| imports.b313.bug(); | ||
| } |
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,6 @@ | ||
| // different module declaration not used for access check | ||
| module foo.bar; | ||
|
|
||
| void bug() | ||
| { | ||
| } |
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,5 @@ | ||
| module imports.pkg313.c313; | ||
|
|
||
| void bug() | ||
| { | ||
| } |
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,3 @@ | ||
| module imports.pkgmod313.mod; | ||
|
|
||
| void bar() {} |
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,5 @@ | ||
| module imports.pkgmod313; | ||
|
|
||
| public import imports.pkgmod313.mod; | ||
|
|
||
| void foo() {} |
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,26 @@ | ||
| /* | ||
| REQUIRED_ARGS: -de | ||
| */ | ||
| module test313; | ||
|
|
||
| import imports.a313; | ||
|
|
||
| void test1() | ||
| { | ||
| import imports.b313; | ||
| imports.b313.bug(); | ||
| } | ||
|
|
||
| void test2() | ||
| { | ||
| cstdio.printf(""); | ||
| } | ||
|
|
||
| import imports.pkg313.c313; | ||
| void test3() | ||
| { | ||
| imports.pkg313.c313.bug(); | ||
| } | ||
|
|
||
| // private symbols from other modules are still visible | ||
| static assert(core.stringof == "package core"); |
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,6 @@ | ||
| // REQUIRED_ARGS: -de | ||
| void test1() | ||
| { | ||
| import core.stdc.stdio; | ||
| core.stdc.stdio.printf(""); | ||
| } |
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 @@ | ||
| // REQUIRED_ARGS: -de | ||
| import imports.pkgmod313; | ||
|
|
||
| void test() | ||
| { | ||
| imports.pkgmod313.foo(); | ||
| imports.pkgmod313.bar(); | ||
| } |
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,9 @@ | ||
| // first imported as package | ||
| // EXTRA_SOURCES: imports/pkgmod313/mod.d | ||
| // REQUIRED_ARGS: -de | ||
| import imports.pkgmod313; // then as package module | ||
|
|
||
| void test() | ||
| { | ||
| imports.pkgmod313.foo(); | ||
| } |
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,9 @@ | ||
| // first resolved as package, then created as module (with name package) | ||
| // EXTRA_SOURCES: imports/pkgmod313/mod.d imports/pkgmod313/package.d | ||
| // REQUIRED_ARGS: -de | ||
| import imports.pkgmod313; // then imported as package module | ||
|
|
||
| void test() | ||
| { | ||
| imports.pkgmod313.foo(); | ||
| } |
Oops, something went wrong.