[Lazarus] 1.2RC1, Incompatible type and overload

Frederic Da Vitoria davitofrg at gmail.com
Fri Dec 6 11:26:12 CET 2013


Hello,

I posted this on the forum, but maybe the forum is not the best place, so I
post it here too.

I have an "Incompatible type" error which I can't figure out

program DominoMo;

{$MODE Delphi}

uses
  Globals in 'GLOBALS.PAS',

  Parametr in 'PARAMETR.PAS';

begin
end.



unit GLOBALS ;

{$MODE Delphi}

interface

  uses Laz2_Dom, Laz_XmlRead, Laz_XmlWrite ;

  const XML_FILE_NAME = 'DominoMot.xml' ;

  var XmlWordLists : TXmlDocument ;

implementation

initialization
  {16} ReadXmlFile (XmlWordLists, XML_FILE_NAME)
end.


unit PARAMETR ;

{$MODE Delphi}

interface

uses SysUtils, XmlWrite, GLOBALS;

implementation

  procedure InitAndShowModal ;
  begin

    {13} //WriteXmlFile (XmlWordLists, ChangeFileExt (ParamStr (0), '.xml'))
  end ;

end.


Using Lazarus 1.2RC1, I get: PARAMETR.PAS(13,69) Error: Incompatible type
for arg no. 2: Got "AnsiString", expected "TStream"
If I comment out line 16, the project compiles OK.
If I put my cursor on ReadXmlFile and press Alt+Up, the editor jumps to the
correct overloaded version
If I put my cursor on WriteXmlFile and press Alt+Up, the editor skips the
string version and jumps to the stream version

Using Lazarus 1.0.14, I get: GLOBALS.PAS(16,43) Error: Incompatible type
for arg no. 2: Got "Constant String", expected "TStream"
If I comment out line 16, the compiler stops on the same error as for 1.2RC1
If I put my cursor on ReadXmlFile and press Alt+Up, the editor skips the
string version and jumps to the stream version
If I put my cursor on WriteXmlFile and press Alt+Up, the editor skips the
string version and jumps to the stream version

I can't figure any of those errors:
None should occur as far as I can see, as ReadXMLFile and WriteXMLFile both
have overloaded versions which take an ansistring for second parameter.

Is this a bug or am I missing something?

 --
Frederic Da Vitoria
(davitof)

Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20131206/f71bad36/attachment-0002.html>


More information about the Lazarus mailing list