mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-12 06:09:22 +02:00
fcl-passrc: resolver: started generic type overload
git-svn-id: trunk@43206 -
This commit is contained in:
parent
6f7a39adab
commit
b70c6cc344
@ -5428,8 +5428,16 @@ function TPasResolver.AddIdentifier(Scope: TPasIdentifierScope;
|
||||
while Identifier<>nil do
|
||||
begin
|
||||
CurEl:=Identifier.Element;
|
||||
if not (CurEl is TPasGenericType) then break;
|
||||
if GetTypeParameterCount(TPasGenericType(CurEl))=TypeParamCnt then break;
|
||||
if CurEl is TPasGenericType then
|
||||
begin
|
||||
if GetTypeParameterCount(TPasGenericType(CurEl))=TypeParamCnt then
|
||||
break;
|
||||
end
|
||||
else
|
||||
begin
|
||||
if TypeParamCnt=0 then
|
||||
break;
|
||||
end;
|
||||
Identifier:=Identifier.NextSameIdentifier;
|
||||
end;
|
||||
Result:=Identifier;
|
||||
@ -5506,7 +5514,7 @@ begin
|
||||
|
||||
// check duplicate in current scope
|
||||
OlderIdentifier:=Identifier.NextSameIdentifier;
|
||||
if IsGeneric then
|
||||
if IsGeneric and (msDelphi in CurrentParser.CurrentModeswitches) then
|
||||
OlderIdentifier:=SkipGenericTypes(OlderIdentifier,TypeParamCnt);
|
||||
if OlderIdentifier<>nil then
|
||||
begin
|
||||
@ -20387,7 +20395,7 @@ begin
|
||||
else
|
||||
NeedPop:=false;
|
||||
|
||||
if (TypeParamCount>0) and (RightPath='') then
|
||||
if (RightPath='') and (TypeParamCount>0) then
|
||||
begin
|
||||
NextEl:=FindGenericEl(CurName,TypeParamCount,FindData,ErrorEl);
|
||||
if (FindData.StartScope<>nil) and (FindData.StartScope.ClassType=ScopeClass_WithExpr)
|
||||
|
@ -58,6 +58,7 @@ type
|
||||
// generic class
|
||||
procedure TestGen_Class;
|
||||
procedure TestGen_ClassDelphi;
|
||||
procedure TestGen_ClassDelphi_TypeOverload; // ToDo
|
||||
procedure TestGen_ClassObjFPC;
|
||||
procedure TestGen_ClassObjFPC_OverloadFail;
|
||||
procedure TestGen_ClassForward;
|
||||
@ -756,6 +757,29 @@ begin
|
||||
ParseProgram;
|
||||
end;
|
||||
|
||||
procedure TTestResolveGenerics.TestGen_ClassDelphi_TypeOverload;
|
||||
begin
|
||||
exit;
|
||||
|
||||
StartProgram(false);
|
||||
Add([
|
||||
'{$mode delphi}',
|
||||
'type',
|
||||
' TObject = class end;',
|
||||
' TBird = word;',
|
||||
' TBird<T> = class',
|
||||
' v: T;',
|
||||
' end;',
|
||||
' TEagle = TBird<word>;',
|
||||
'var',
|
||||
' b: TBird<word>;',
|
||||
' w: TBird;',
|
||||
'begin',
|
||||
' b.v:=w;',
|
||||
'']);
|
||||
ParseProgram;
|
||||
end;
|
||||
|
||||
procedure TTestResolveGenerics.TestGen_ClassObjFPC;
|
||||
begin
|
||||
StartProgram(false);
|
||||
|
Loading…
Reference in New Issue
Block a user