mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-14 14:29:14 +02:00
* fix #40381: also check for hints when parsing the parameters of a routine (including open array parameters) or the result type of a function
+ added tests
This commit is contained in:
parent
8fa439e64d
commit
2df57e117b
@ -400,6 +400,8 @@ implementation
|
|||||||
else
|
else
|
||||||
stoptions:=[];
|
stoptions:=[];
|
||||||
single_type(arrayelementdef,stoptions);
|
single_type(arrayelementdef,stoptions);
|
||||||
|
if assigned(arrayelementdef.typesym) then
|
||||||
|
check_hints(arrayelementdef.typesym,arrayelementdef.typesym.symoptions,arrayelementdef.typesym.deprecatedmsg);
|
||||||
tarraydef(hdef).elementdef:=arrayelementdef;
|
tarraydef(hdef).elementdef:=arrayelementdef;
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
@ -469,6 +471,9 @@ implementation
|
|||||||
else
|
else
|
||||||
hdef:=cformaltype;
|
hdef:=cformaltype;
|
||||||
|
|
||||||
|
if assigned(hdef.typesym) then
|
||||||
|
check_hints(hdef.typesym,hdef.typesym.symoptions,hdef.typesym.deprecatedmsg);
|
||||||
|
|
||||||
{ File types are only allowed for var and out parameters }
|
{ File types are only allowed for var and out parameters }
|
||||||
if (hdef.typ=filedef) and
|
if (hdef.typ=filedef) and
|
||||||
not(varspez in [vs_out,vs_var]) then
|
not(varspez in [vs_out,vs_var]) then
|
||||||
@ -1407,6 +1412,9 @@ implementation
|
|||||||
if is_dispinterface(pd.struct) and not is_automatable(pd.returndef) then
|
if is_dispinterface(pd.struct) and not is_automatable(pd.returndef) then
|
||||||
Message1(type_e_not_automatable,pd.returndef.typename);
|
Message1(type_e_not_automatable,pd.returndef.typename);
|
||||||
|
|
||||||
|
if assigned(pd.returndef.typesym) then
|
||||||
|
check_hints(pd.returndef.typesym,pd.returndef.typesym.symoptions,pd.returndef.typesym.deprecatedmsg);
|
||||||
|
|
||||||
if pd.is_generic or pd.is_specialization then
|
if pd.is_generic or pd.is_specialization then
|
||||||
symtablestack.pop(pd.parast);
|
symtablestack.pop(pd.parast);
|
||||||
if popclass>0 then
|
if popclass>0 then
|
||||||
|
31
tests/webtbs/tw40381a.pp
Normal file
31
tests/webtbs/tw40381a.pp
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
{ %FAIL }
|
||||||
|
|
||||||
|
program tw40381a;
|
||||||
|
|
||||||
|
{$mode objfpc}
|
||||||
|
{$warn 5043 error}
|
||||||
|
|
||||||
|
type
|
||||||
|
TFoo = 1..9 deprecated;
|
||||||
|
|
||||||
|
TBar = class
|
||||||
|
//F1: TFoo;
|
||||||
|
procedure M1(x:TFoo);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{var
|
||||||
|
a: TFoo;}
|
||||||
|
|
||||||
|
{procedure b(x:TFoo);
|
||||||
|
begin
|
||||||
|
writeln(x);
|
||||||
|
end;}
|
||||||
|
|
||||||
|
procedure TBar.M1(x: TFoo);
|
||||||
|
begin
|
||||||
|
writeln(x);
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
end.
|
||||||
|
|
31
tests/webtbs/tw40381b.pp
Normal file
31
tests/webtbs/tw40381b.pp
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
{ %FAIL }
|
||||||
|
|
||||||
|
program tw40381b;
|
||||||
|
|
||||||
|
{$mode objfpc}
|
||||||
|
{$warn 5043 error}
|
||||||
|
|
||||||
|
type
|
||||||
|
TFoo = 1..9 deprecated;
|
||||||
|
|
||||||
|
TBar = class
|
||||||
|
//F1: TFoo;
|
||||||
|
//procedure M1(x:TFoo);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{var
|
||||||
|
a: TFoo;}
|
||||||
|
|
||||||
|
procedure b(x:TFoo);
|
||||||
|
begin
|
||||||
|
writeln(x);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{procedure TBar.M1(x: TFoo);
|
||||||
|
begin
|
||||||
|
writeln(x);
|
||||||
|
end;}
|
||||||
|
|
||||||
|
begin
|
||||||
|
end.
|
||||||
|
|
31
tests/webtbs/tw40381c.pp
Normal file
31
tests/webtbs/tw40381c.pp
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
{ %FAIL }
|
||||||
|
|
||||||
|
program tw40381c;
|
||||||
|
|
||||||
|
{$mode objfpc}
|
||||||
|
{$warn 5043 error}
|
||||||
|
|
||||||
|
type
|
||||||
|
TFoo = 1..9 deprecated;
|
||||||
|
|
||||||
|
TBar = class
|
||||||
|
//F1: TFoo;
|
||||||
|
//procedure M1(x:TFoo);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{var
|
||||||
|
a: TFoo;}
|
||||||
|
|
||||||
|
procedure b(x:array of TFoo);
|
||||||
|
begin
|
||||||
|
//writeln(x);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{procedure TBar.M1(x: TFoo);
|
||||||
|
begin
|
||||||
|
writeln(x);
|
||||||
|
end;}
|
||||||
|
|
||||||
|
begin
|
||||||
|
end.
|
||||||
|
|
31
tests/webtbs/tw40381d.pp
Normal file
31
tests/webtbs/tw40381d.pp
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
{ %FAIL }
|
||||||
|
|
||||||
|
program tw40381d;
|
||||||
|
|
||||||
|
{$mode objfpc}
|
||||||
|
{$warn 5043 error}
|
||||||
|
|
||||||
|
type
|
||||||
|
TFoo = 1..9 deprecated;
|
||||||
|
|
||||||
|
TBar = class
|
||||||
|
//F1: TFoo;
|
||||||
|
function M1:TFoo;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{var
|
||||||
|
a: TFoo;}
|
||||||
|
|
||||||
|
{procedure b(x:TFoo);
|
||||||
|
begin
|
||||||
|
writeln(x);
|
||||||
|
end;}
|
||||||
|
|
||||||
|
function TBar.M1:TFoo;
|
||||||
|
begin
|
||||||
|
// writeln(x);
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
end.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user