Codetools: parse specialization as function result (in function type def) Issue #38970

This commit is contained in:
Martin 2023-03-10 16:56:06 +01:00
parent 7172fd48e9
commit f0901a9512
2 changed files with 33 additions and 2 deletions

View File

@ -4965,8 +4965,13 @@ begin
if IsFunction then begin
if (CurPos.Flag=cafColon) then begin
ReadNextAtom;
AtomIsIdentifierSaveE(20180411194218);
ReadNextAtom;
if UpAtomIs('SPECIALIZE') then begin
ReadSpecialize(true);
end
else begin
AtomIsIdentifierSaveE(20180411194218);
ReadNextAtom;
end;
if CurPos.Flag=cafPoint then begin
ReadNextAtom;
AtomIsIdentifierSaveE(20180411194221);

View File

@ -0,0 +1,26 @@
program bug38970;
{$mode objfpc}{$H+}
{$modeswitch nestedprocvars}
uses
{$IFDEF UNIX}
cthreads,
{$ENDIF}
Classes
{ you can add units after this };
type
generic TOption<T> = record
end;
generic TIterNestedFunc<T> = function (): specialize TOption{declaration:TOption}<T> is nested;
procedure Test;
begin
end;
begin
end.