mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 05:00:16 +03:00
fix Issue 21832 - Wrong deprecation message when importing non-deprecated template in static condition
This commit is contained in:
parent
12741d721a
commit
541b27e12b
6 changed files with 86 additions and 3 deletions
|
@ -219,7 +219,10 @@ private void resolveHelper(TypeQualified mt, const ref Loc loc, Scope* sc, Dsymb
|
|||
else
|
||||
{
|
||||
// check for deprecated or disabled aliases
|
||||
s.checkDeprecated(loc, sc);
|
||||
// functions are checked after overloading
|
||||
// templates are checked after matching constraints
|
||||
if (!s.isFuncDeclaration() && !s.isTemplateDeclaration())
|
||||
s.checkDeprecated(loc, sc);
|
||||
if (d)
|
||||
d.checkDisabled(loc, sc, true);
|
||||
}
|
||||
|
|
24
test/compilable/imports/imp21832.d
Normal file
24
test/compilable/imports/imp21832.d
Normal file
|
@ -0,0 +1,24 @@
|
|||
module imports.imp21832;
|
||||
static if(1)
|
||||
{
|
||||
int fun(int a)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
int tpl()(int a)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
deprecated
|
||||
{
|
||||
int fun(char a)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
int tpl()(char a)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
}
|
13
test/compilable/test21832.d
Normal file
13
test/compilable/test21832.d
Normal file
|
@ -0,0 +1,13 @@
|
|||
// REQUIRED_ARGS: -de
|
||||
// EXTRA_FILES: imports/imp21832.d
|
||||
int test21832a()
|
||||
{
|
||||
import imports.imp21832 : fun; // function 'fun' is deprecated
|
||||
return fun(0);
|
||||
}
|
||||
|
||||
int test21832b()
|
||||
{
|
||||
import imports.imp21832 : tpl; // template 'tpl' is deprecated
|
||||
return tpl(0);
|
||||
}
|
|
@ -2,8 +2,6 @@
|
|||
TEST_OUTPUT
|
||||
---
|
||||
fail_compilation/fail21830.d(24): Deprecation: struct `fail21830.OldS21830` is deprecated - Deprecated type
|
||||
fail_compilation/fail21830.d(8): Deprecation: struct `fail21830.OldS21830` is deprecated - Deprecated type
|
||||
fail_compilation/fail21830.d(24): instantiated from here: `test21830!(OldS21830)`
|
||||
fail_compilation/fail21830.d(24): Deprecation: template `fail21830.test21830(T)(T t) if (is(T == OldS21830))` is deprecated - Deprecated template
|
||||
fail_compilation/fail21830.d(24): Deprecation: struct `fail21830.OldS21830` is deprecated - Deprecated type
|
||||
---
|
||||
|
|
21
test/fail_compilation/fail21832.d
Normal file
21
test/fail_compilation/fail21832.d
Normal file
|
@ -0,0 +1,21 @@
|
|||
// REQUIRED_ARGS: -de
|
||||
// EXTRA_FILES: imports/imp21832.d
|
||||
/*
|
||||
TEST_OUTPUT
|
||||
---
|
||||
fail_compilation/fail21832.d(4): Deprecation: function `imports.imp21832.fun` is deprecated
|
||||
fail_compilation/fail21832.d(10): Deprecation: template `imports.imp21832.tpl()(char a)` is deprecated
|
||||
---
|
||||
*/
|
||||
#line 1
|
||||
int test21832a()
|
||||
{
|
||||
import imports.imp21832 : fun;
|
||||
return fun('a');
|
||||
}
|
||||
|
||||
int test21832b()
|
||||
{
|
||||
import imports.imp21832 : tpl;
|
||||
return tpl('a');
|
||||
}
|
24
test/fail_compilation/imports/imp21832.d
Normal file
24
test/fail_compilation/imports/imp21832.d
Normal file
|
@ -0,0 +1,24 @@
|
|||
module imports.imp21832;
|
||||
static if(1)
|
||||
{
|
||||
int fun(int a)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
int tpl()(int a)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
deprecated
|
||||
{
|
||||
int fun(char a)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
int tpl()(char a)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue