[Lazarus] Bug on CodeTools to find unit using in `../path/unit.pas`

Mattias Gaertner nc-gaertnma at netcologne.de
Mon Dec 10 09:39:50 CET 2018

On Sun, 9 Dec 2018 22:33:47 -0200
"Marcos Douglas B. Santos via lazarus" <lazarus at lists.lazarus-ide.org>

> unit A;
> uses msg1 in 'msg/msg.pas'
> -----
> unit B;
> uses msg2 in 'msg/msg.pas'
> As I understood, when the compiler knows about `msg.pas`, it will use
> the first identifier that appeared, which is `msg1`. And that is a
> problem. Why?

For better chance of getting an answer you can ask the fpc
developers on the fpc list.

Note that the 'in' feature came from Delphi, where it is used to mark
which unit belongs to the project/package. And in Delphi the unitname
must match.
FPC extended it to allow alias, but afaik it is hardly used.

> And I've discovered another issue on IDE:
> If I use like above `foo in 'path/Some.Long.Name.Unit.pas';`, IDE will
> save on XML project files the unit as `Some.Long.Name.Unit`, when it
> should be `foo` as the name of the unit.

That is the cached name of the unit name from its source, not some
alias name. The IDE does not yet support alias names. Only a few
functions support the 'in' alias.


More information about the Lazarus mailing list