diff --git a/packages/pastojs/tests/tcfiler.pas b/packages/pastojs/tests/tcfiler.pas index 99dd31ad7f..a6500c9ae1 100644 --- a/packages/pastojs/tests/tcfiler.pas +++ b/packages/pastojs/tests/tcfiler.pas @@ -639,24 +639,75 @@ end; procedure TCustomTestPrecompile.CheckRestoredDeclarations(const Path: string; Orig, Rest: TPasDeclarations; Flags: TPCCheckFlags); + + function IsSpecialization(El: TPasElement): boolean; + begin + Result:=(El.CustomData is TPasGenericScope) + and (TPasGenericScope(El.CustomData).SpecializedFromItem<>nil); + end; + var - i: Integer; + OrigIndex, RestIndex: Integer; OrigDecl, RestDecl: TPasElement; SubPath: String; begin - for i:=0 to Orig.Declarations.Count-1 do + // check non specializations + RestIndex:=0; + for OrigIndex:=0 to Orig.Declarations.Count-1 do begin - OrigDecl:=TPasElement(Orig.Declarations[i]); - if i>=Rest.Declarations.Count then - AssertEquals(Path+'.Declarations.Count',Orig.Declarations.Count,Rest.Declarations.Count); - RestDecl:=TPasElement(Rest.Declarations[i]); - SubPath:=Path+'['+IntToStr(i)+']'; + OrigDecl:=TPasElement(Orig.Declarations[OrigIndex]); + if IsSpecialization(OrigDecl) then + continue; + SubPath:=Path+'['+IntToStr(OrigIndex)+']'; if OrigDecl.Name<>'' then SubPath:=SubPath+'"'+OrigDecl.Name+'"' else SubPath:=SubPath+'?noname?'; + // skip to next non specializations in restored declarations + while RestIndex'' then + SubPath:=SubPath+'"'+OrigDecl.Name+'"' + else + SubPath:=SubPath+'?noname?'; + // search specialization with same name + RestIndex:=0; + while RestIndex