View Issue Details

IDProjectCategoryView StatusLast Update
0034774LazarusPatchpublic2018-12-29 22:29
ReporterJonas MaebeAssigned Towp 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformAllOSOS Version
Product Version2.2Product Build 
Target Version2.0Fixed in Version2.0 
Summary0034774: Add missing overload directives in TBasicDrawer class (tachart/tadrawutils.pas)
DescriptionTBasicDrawer implements two overloads of LineTo and MoveTo, but without the overload directive.

TCanvasDrawer inherits from TBasicDrawer. It overrides one of the LineTo and one of the MoveTo methods from TBasicDrawer. This means that normally, the other overload gets hidden (won't be found by the compiler when you try to call these methods).

However, the TCanvasDrawer class also implements the IChartDrawer interface. This interace also declares both overloads of the LineTo and MoveTo.

Until now, the compiler mapped one of the interface methods to TCanvasDrawer.LineTo/MoveTo and the other one to the non-overridden TBasicDrawer.LineTo/MoveTo. That is incorrect due to the missing overload directive. Instead, it should complain that it cannot find a mapping for the remaining LineTo/MoveTo methods. It does so since FPC trunk r40683.

I have attached a patch to add the missing overload directives.
Steps To Reproducemake bigide
TagsNo tags attached.
Fixed in Revision59935
LazTarget2.0
Widgetset
Attached Files
  • tachart-overload.patch (1,651 bytes)
    Index: components/tachart/tadrawutils.pas
    ===================================================================
    --- components/tachart/tadrawutils.pas	(revision 59927)
    +++ components/tachart/tadrawutils.pas	(working copy)
    @@ -163,10 +163,10 @@
         function GetFontSize: Integer; virtual; abstract;
         function GetFontStyle: TChartFontStyles; virtual; abstract;
         function GetRightToLeft: Boolean;
    -    procedure LineTo(AX, AY: Integer); virtual; abstract;
    -    procedure LineTo(const AP: TPoint);
    -    procedure MoveTo(AX, AY: Integer); virtual; abstract;
    -    procedure MoveTo(const AP: TPoint);
    +    procedure LineTo(AX, AY: Integer); virtual; abstract; overload;
    +    procedure LineTo(const AP: TPoint); overload;
    +    procedure MoveTo(AX, AY: Integer); virtual; abstract; overload;
    +    procedure MoveTo(const AP: TPoint); overload;
         procedure Polygon(
           const APoints: array of TPoint; AStartIndex, ANumPts: Integer); virtual; abstract;
         procedure PutImage(AX, AY: Integer; AImage: TFPCustomImage); virtual;
    @@ -179,8 +179,8 @@
         procedure SetRightToLeft(AValue: Boolean);
         procedure SetTransparency(ATransparency: TChartTransparency);
         procedure SetXor(AXor: Boolean);
    -    function TextExtent(const AText: String; ATextFormat: TChartTextFormat = tfNormal): TPoint;
    -    function TextExtent(AText: TStrings; ATextFormat: TChartTextFormat = tfNormal): TPoint;
    +    function TextExtent(const AText: String; ATextFormat: TChartTextFormat = tfNormal): TPoint; overload;
    +    function TextExtent(AText: TStrings; ATextFormat: TChartTextFormat = tfNormal): TPoint; overload;
         function TextOut: TChartTextOut;
       end;
     
    
    tachart-overload.patch (1,651 bytes)

Activities

Jonas Maebe

2018-12-28 19:28

manager  

tachart-overload.patch (1,651 bytes)
Index: components/tachart/tadrawutils.pas
===================================================================
--- components/tachart/tadrawutils.pas	(revision 59927)
+++ components/tachart/tadrawutils.pas	(working copy)
@@ -163,10 +163,10 @@
     function GetFontSize: Integer; virtual; abstract;
     function GetFontStyle: TChartFontStyles; virtual; abstract;
     function GetRightToLeft: Boolean;
-    procedure LineTo(AX, AY: Integer); virtual; abstract;
-    procedure LineTo(const AP: TPoint);
-    procedure MoveTo(AX, AY: Integer); virtual; abstract;
-    procedure MoveTo(const AP: TPoint);
+    procedure LineTo(AX, AY: Integer); virtual; abstract; overload;
+    procedure LineTo(const AP: TPoint); overload;
+    procedure MoveTo(AX, AY: Integer); virtual; abstract; overload;
+    procedure MoveTo(const AP: TPoint); overload;
     procedure Polygon(
       const APoints: array of TPoint; AStartIndex, ANumPts: Integer); virtual; abstract;
     procedure PutImage(AX, AY: Integer; AImage: TFPCustomImage); virtual;
@@ -179,8 +179,8 @@
     procedure SetRightToLeft(AValue: Boolean);
     procedure SetTransparency(ATransparency: TChartTransparency);
     procedure SetXor(AXor: Boolean);
-    function TextExtent(const AText: String; ATextFormat: TChartTextFormat = tfNormal): TPoint;
-    function TextExtent(AText: TStrings; ATextFormat: TChartTextFormat = tfNormal): TPoint;
+    function TextExtent(const AText: String; ATextFormat: TChartTextFormat = tfNormal): TPoint; overload;
+    function TextExtent(AText: TStrings; ATextFormat: TChartTextFormat = tfNormal): TPoint; overload;
     function TextOut: TChartTextOut;
   end;
 
tachart-overload.patch (1,651 bytes)

wp

2018-12-29 11:57

developer   ~0112975

Last edited: 2018-12-29 12:00

View 2 revisions

I can't build Lazarus trunk with fpc-trunk r40687: "Compiling fcllaz.pas ... Fatal: (10022) Can't find unit db used by fcllaz" (Win10/64bit, fpc/32-bit)

Cyrax

2018-12-29 13:48

reporter   ~0112979

Did you clean up the Lazarus directory of old binary files?

wp

2018-12-29 13:59

developer   ~0112980

Of course. I also made an absolutely clean new installation of fpc and laz with fpcupdeluxe.

Cyrax

2018-12-29 14:16

reporter   ~0112981

Well, then you need to go back revision by revision of FPC trunk until Lazarus trunk compiles.

wp

2018-12-29 19:22

developer   ~0112986

It is r40686 which breaks it ("(modified) path by Gareth Moreton to fix case handling", applied by Florian); r40685 still compiles fine.

wp

2018-12-29 20:29

developer   ~0112989

Applied the patch. Tested with fpc r40685.

wp

2018-12-29 22:29

developer   ~0112994

I opened a separate reported for the compilation issue (0034779).

Resolving.

Issue History

Date Modified Username Field Change
2018-12-28 19:28 Jonas Maebe New Issue
2018-12-28 19:28 Jonas Maebe File Added: tachart-overload.patch
2018-12-28 19:55 wp Assigned To => wp
2018-12-28 19:55 wp Status new => assigned
2018-12-29 11:57 wp Note Added: 0112975
2018-12-29 11:57 wp Status assigned => feedback
2018-12-29 12:00 wp Note Edited: 0112975 View Revisions
2018-12-29 13:48 Cyrax Note Added: 0112979
2018-12-29 13:59 wp Note Added: 0112980
2018-12-29 14:16 Cyrax Note Added: 0112981
2018-12-29 19:22 wp Note Added: 0112986
2018-12-29 20:29 wp Note Added: 0112989
2018-12-29 22:29 wp Fixed in Revision => 59935
2018-12-29 22:29 wp LazTarget - => 2.0
2018-12-29 22:29 wp Note Added: 0112994
2018-12-29 22:29 wp Status feedback => resolved
2018-12-29 22:29 wp Fixed in Version => 2.0
2018-12-29 22:29 wp Resolution open => fixed
2018-12-29 22:29 wp Target Version => 2.0