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 #5690 from 9rnsr/fix13242
Issue 13242 - imported aliases should be analyzed lazily
- Loading branch information
Showing
8 changed files
with
138 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module imports.test13242a; | ||
|
||
template expensiveArgs(alias v) | ||
{ | ||
pragma(msg, "a.expensiveArgs: ", v); | ||
} | ||
|
||
template expensiveTemplate(Args...) | ||
{ | ||
pragma(msg, "a.expensiveTemplate: ", Args[0]); | ||
} | ||
|
||
alias apiSym1 = expensiveTemplate!(1, expensiveArgs!(1)); | ||
|
||
alias apiSym2 = expensiveTemplate!(2, expensiveArgs!(2)); | ||
|
||
public import imports.test13242b : apiSym3; | ||
|
||
void cheapFunc() {} |
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,13 @@ | ||
module imports.test13242b; | ||
|
||
template expensiveArgs(alias v) | ||
{ | ||
pragma(msg, "b.expensiveArgs: ", v); | ||
} | ||
|
||
template expensiveTemplate(Args...) | ||
{ | ||
pragma(msg, "b.expensiveTemplate: ", Args[0]); | ||
} | ||
|
||
alias apiSym3 = expensiveTemplate!(3, expensiveArgs!(3)); |
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,34 @@ | ||
// REQUIRED_ARGS: -o- | ||
/* | ||
TEST_OUTPUT: | ||
--- | ||
main | ||
+alias apiSym1 | ||
a.expensiveArgs: 1 | ||
a.expensiveTemplate: 1 | ||
-alias apiSym1 | ||
+alias apiSym3 | ||
b.expensiveArgs: 3 | ||
b.expensiveTemplate: 3 | ||
-alias apiSym3 | ||
--- | ||
*/ | ||
|
||
import imports.test13242a; | ||
|
||
void main() | ||
{ | ||
pragma(msg, "main"); | ||
|
||
cheapFunc(); | ||
|
||
pragma(msg, "+alias apiSym1"); | ||
alias apiSym1 = .apiSym1; | ||
pragma(msg, "-alias apiSym1"); | ||
|
||
// imports.test13242a.apiSym2 is not analyzed. | ||
|
||
pragma(msg, "+alias apiSym3"); | ||
alias apiSym3 = .apiSym3; | ||
pragma(msg, "-alias apiSym3"); | ||
} |