View Issue Details

IDProjectCategoryView StatusLast Update
0036494LazarusPackagespublic2020-01-11 00:49
ReporterJernejL Assigned ToJuha Manninen  
Status resolvedResolutionfixed 
Product Version2.0 
Summary0036494: codetools - issues with generics when it is used for a record
DescriptionI have a record with methods that is a template, this produces various failures in codetools in lazarus ide, freepascal compiler compiles this nicely, but codetools complains on definition line, that: "Error: expected =, but < found"
All neccesary compiler defines are in place, for templates to work.
    IRectT<T> = packed record
        function getheight: T;
        function getwidth: T;
        procedure setheight(AValue: T);
        procedure setwidth(AValue: T);
        Bottom: T; // todo: int64

        function same(b : IRectT<T>) : boolean; inline;
        function contains(b : IRectT<T>) : boolean; inline;

        procedure blank;
        function IsBlank: boolean;
        class function buildrect(const aleft, atop, aright, abottom: T): IRectT<T>; static;
        class function buildrectWH(const aleft, atop, aWidth, aheight: T): IRectT<T>; static;

        procedure Center(const withrect: IRectT<T>; centerv, centerh: boolean); inline;

        function CalcAspectRatio(const fitinto: IRectT<T>): IRectT<T>;

        function tostring(): widestring;

        procedure Combine(const second: IRectT<T>); inline;
        procedure Trim(const second: IRectT<T>); inline;
        procedure IncludePoint(const pointx, pointy: T);
        procedure inflateMe(const delta: T); overload; inline;
        function Inflate(const delta: T): IRectT<T>; overload; inline;
        function Dimensions(): BigIntVector; inline;
        function CalculateArea(): T; inline;
        procedure constrain(const minx, miny, maxx, maxy: T); inline;
        procedure moveTo(const x,y: T); inline;
        procedure moveby(const x,y: T); inline;
        procedure scalediv(const bx, by: single); inline;
        function squarearea(): T;

        property width: T read getwidth write setwidth;
        property height: T read getheight write setheight;
        property x: T read left;
        property y: T read top;

        class Operator = (A : IRectT<T>; B : IRectT<T>) C : boolean;


    IRect = IRectT<int32>;
    IRect32 = IRectT<int32>;
TagsNo tags attached.
Fixed in Revision
Attached Files


related to 0034824 resolvedMattias Gaertner Code navigation fails with generics 



2019-12-30 11:19

reporter   ~0120142

Can you test if Lazarus trunk works, please?

Juha Manninen

2019-12-30 12:39

developer   ~0120144

Last edited: 2019-12-30 12:40

View 2 revisions

I tested with the latest trunk (r62468) and it works with {$mode delphi}.
Which mode you use?. Does FPC compile it with {$mode objfpc}?

BTW, it is called generics in Object Pascal. I change the summary accordingly.


2019-12-31 18:56

reporter   ~0120173

i used mode delphi, where can i get a built trunk for win32?

Juha Manninen

2020-01-02 14:18

developer   ~0120182

> where can i get a built trunk for win32?
You can download sources and build it easily yourself.
I recommend TortoiseSVN client when using Windows.
Make sure FPC is in your PATH.

Juha Manninen

2020-01-11 00:49

developer   ~0120319

I resolve this now. If you still have the problem with trunk, please reopen. Otherwise please close.

Issue History

Date Modified Username Field Change
2019-12-30 09:00 JernejL New Issue
2019-12-30 11:19 Cyrax Note Added: 0120142
2019-12-30 12:38 Juha Manninen Relationship added related to 0034824
2019-12-30 12:39 Juha Manninen Note Added: 0120144
2019-12-30 12:40 Juha Manninen Note Edited: 0120144 View Revisions
2019-12-30 12:41 Juha Manninen Category IDE => Packages
2019-12-30 12:41 Juha Manninen Summary codetools - issues with templates, when that template is a record => codetools - issues with generics when it is used for a record
2019-12-30 12:41 Juha Manninen LazTarget => -
2019-12-30 15:29 Juha Manninen Assigned To => Juha Manninen
2019-12-30 15:29 Juha Manninen Status new => feedback
2019-12-31 18:56 JernejL Note Added: 0120173
2019-12-31 18:56 JernejL Status feedback => assigned
2020-01-02 14:18 Juha Manninen Note Added: 0120182
2020-01-11 00:49 Juha Manninen Status assigned => resolved
2020-01-11 00:49 Juha Manninen Resolution open => fixed
2020-01-11 00:49 Juha Manninen Note Added: 0120319