* correctly handle unit identifiers inside specializations of generic routines

git-svn-id: trunk@37080 -
This commit is contained in:
svenbarth 2017-08-29 18:29:10 +00:00
parent 9ead4329c6
commit 83e4585b0f
4 changed files with 45 additions and 1 deletions

2
.gitattributes vendored
View File

@ -11375,6 +11375,7 @@ tests/tbs/tb0627.pp svneol=native#text/pascal
tests/tbs/tb0627a.pp svneol=native#text/pascal
tests/tbs/tb0627b.pp svneol=native#text/pascal
tests/tbs/tb0628.pp svneol=native#text/pascal
tests/tbs/tb0629.pp svneol=native#text/pascal
tests/tbs/tb205.pp svneol=native#text/plain
tests/tbs/tb610.pp svneol=native#text/pascal
tests/tbs/tb613.pp svneol=native#text/plain
@ -11414,6 +11415,7 @@ tests/tbs/ub0489.pp svneol=native#text/plain
tests/tbs/ub0489b.pp svneol=native#text/plain
tests/tbs/ub0506.pp svneol=native#text/plain
tests/tbs/ub0569.pp svneol=native#text/pascal
tests/tbs/ub0629.pp svneol=native#text/pascal
tests/test/README.txt svneol=native#text/plain
tests/test/alglib/t_testconvunit.pp svneol=native#text/plain
tests/test/alglib/t_testcorrunit.pp svneol=native#text/plain

View File

@ -3135,7 +3135,12 @@ implementation
(
not(srsym.typ in [unitsym,namespacesym]) or
srsymtable.iscurrentunit or
(assigned(current_specializedef)and(current_specializedef.genericdef.owner.moduleid=srsymtable.moduleid))
(assigned(current_specializedef)and(current_specializedef.genericdef.owner.moduleid=srsymtable.moduleid)) or
(
assigned(current_procinfo) and
(df_specialization in current_procinfo.procdef.defoptions) and
(current_procinfo.procdef.genericdef.owner.moduleid=srsymtable.moduleid)
)
) and
(not (ssf_search_option in flags) or (option in srsym.symoptions))then
begin

14
tests/tbs/tb0629.pp Normal file
View File

@ -0,0 +1,14 @@
{ %NORUN }
program tb0629;
{$mode objfpc}
uses
ub0629, typinfo;
var
ti: PTypeInfo;
begin
ti := TTest.specialize GetTypeInfo<LongInt>;
end.

23
tests/tbs/ub0629.pp Normal file
View File

@ -0,0 +1,23 @@
unit ub0629;
{$mode objfpc}
{$modeswitch advancedrecords}
interface
uses
typinfo;
type
TTest = record
generic class function GetTypeInfo<T>: PTypeInfo; static;
end;
implementation
generic class function TTest.GetTypeInfo<T>: PTypeInfo;
begin
Result := System.TypeInfo(T);
end;
end.