mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 17:39:20 +02:00
Fix for Mantis #28530.
ptype.pas: * record_dec: if parse_generic is given set current_genericdef + added test git-svn-id: trunk@31437 -
This commit is contained in:
parent
90a31bef49
commit
66781b5526
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -14694,6 +14694,7 @@ tests/webtbs/tw28442.pp svneol=native#text/pascal
|
|||||||
tests/webtbs/tw28454.pp svneol=native#text/plain
|
tests/webtbs/tw28454.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw28475.pp svneol=native#text/plain
|
tests/webtbs/tw28475.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2853.pp svneol=native#text/plain
|
tests/webtbs/tw2853.pp svneol=native#text/plain
|
||||||
|
tests/webtbs/tw28530.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw2853a.pp svneol=native#text/plain
|
tests/webtbs/tw2853a.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2853b.pp svneol=native#text/plain
|
tests/webtbs/tw2853b.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2853c.pp svneol=native#text/plain
|
tests/webtbs/tw2853c.pp svneol=native#text/plain
|
||||||
|
@ -928,10 +928,7 @@ implementation
|
|||||||
include(current_structdef.defoptions,df_specialization);
|
include(current_structdef.defoptions,df_specialization);
|
||||||
if assigned(old_current_structdef) and
|
if assigned(old_current_structdef) and
|
||||||
(df_generic in old_current_structdef.defoptions) then
|
(df_generic in old_current_structdef.defoptions) then
|
||||||
begin
|
include(current_structdef.defoptions,df_generic);
|
||||||
include(current_structdef.defoptions,df_generic);
|
|
||||||
current_genericdef:=current_structdef;
|
|
||||||
end;
|
|
||||||
|
|
||||||
insert_generic_parameter_types(current_structdef,genericdef,genericlist);
|
insert_generic_parameter_types(current_structdef,genericdef,genericlist);
|
||||||
{ when we are parsing a generic already then this is a generic as
|
{ when we are parsing a generic already then this is a generic as
|
||||||
@ -939,6 +936,8 @@ implementation
|
|||||||
if old_parse_generic then
|
if old_parse_generic then
|
||||||
include(current_structdef.defoptions, df_generic);
|
include(current_structdef.defoptions, df_generic);
|
||||||
parse_generic:=(df_generic in current_structdef.defoptions);
|
parse_generic:=(df_generic in current_structdef.defoptions);
|
||||||
|
if parse_generic and not assigned(current_genericdef) then
|
||||||
|
current_genericdef:=current_structdef;
|
||||||
{ in non-Delphi modes we need a strict private symbol without type
|
{ in non-Delphi modes we need a strict private symbol without type
|
||||||
count and type parameters in the name to simply resolving }
|
count and type parameters in the name to simply resolving }
|
||||||
maybe_insert_generic_rename_symbol(n,genericlist);
|
maybe_insert_generic_rename_symbol(n,genericlist);
|
||||||
|
25
tests/webtbs/tw28530.pp
Normal file
25
tests/webtbs/tw28530.pp
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{ %NORUN }
|
||||||
|
|
||||||
|
program tw28530;
|
||||||
|
|
||||||
|
{$mode objfpc}
|
||||||
|
|
||||||
|
type
|
||||||
|
generic TDistanceFunction<t> = function (x,y : t) : Extended;
|
||||||
|
|
||||||
|
generic PlanarCoordinate<t> = record
|
||||||
|
x,y : t;
|
||||||
|
d : specialize TDistanceFunction<t>;
|
||||||
|
end;
|
||||||
|
TScreenCoordinate = specialize PLanarCoordinate<word>;
|
||||||
|
TDiscreteCoordinate = specialize PlanarCoordinate<integer>;
|
||||||
|
TRealCoordinate = specialize PlanarCoordinate<extended>;
|
||||||
|
|
||||||
|
TScreenDistance = specialize TDistanceFunction<word>;
|
||||||
|
TDiscreteDistance = specialize TDistanceFunction<integer>;
|
||||||
|
TRealDistance = specialize TDistanceFunction<Extended>;
|
||||||
|
|
||||||
|
generic TPointSet<t> = array of specialize PlanarCoordinate<t>;
|
||||||
|
|
||||||
|
begin
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user