Skip to content

Commit

Permalink
Fix issue 13582: don't print deprecation when importing a deprecated …
Browse files Browse the repository at this point in the history
…module from another deprecated module.
  • Loading branch information
FeepingCreature authored and Geod24 committed Aug 24, 2019
1 parent bd787fd commit bc2acbd
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/dmd/dimport.d
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ extern (C++) final class Import : Dsymbol
if (!mod) return; // Failed

mod.importAll(null);
if (mod.md && mod.md.isdeprecated)
if (mod.md && mod.md.isdeprecated && !sc.isDeprecated)
{
Expression msg = mod.md.msg;
if (StringExp se = msg ? msg.toStringExp() : null)
Expand Down
4 changes: 4 additions & 0 deletions src/dmd/dscope.d
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,10 @@ struct Scope
if (sc2.stc & STC.deprecated_)
return true;
}
if (_module.md && _module.md.isdeprecated)
{
return true;
}
return false;
}
}
1 change: 1 addition & 0 deletions test/compilable/imports/test13582.d
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deprecated module imports.test13582;
6 changes: 6 additions & 0 deletions test/compilable/test13582a.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// REQUIRED_ARGS: -de
deprecated module test13582a;

import imports.test13582;

void main() { }
14 changes: 14 additions & 0 deletions test/compilable/test13582b.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// REQUIRED_ARGS: -de
module test13582b;

deprecated void foo()
{
import imports.test13582;
}

deprecated struct S
{
import imports.test13582;
}

void main() { }

0 comments on commit bc2acbd

Please sign in to comment.