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

Marcos Douglas B. Santos md at delfire.net
Mon Dec 10 13:23:21 CET 2018


On Mon, Dec 10, 2018 at 6:39 AM Mattias Gaertner via lazarus
<lazarus at lists.lazarus-ide.org> wrote:
>
> On Sun, 9 Dec 2018 22:33:47 -0200
> "Marcos Douglas B. Santos via lazarus" <lazarus at lists.lazarus-ide.org>
> wrote:
>
> >[...]
> > 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.

Indeed, you're right. I've tested and it doesn't work, at least on Delphi 7.

> FPC extended it to allow alias, but afaik it is hardly used.
>

It could be a great feature for both compilers, IMHO.

> >[...]
> > 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.

I got it, thanks.

Marcos Douglas


More information about the Lazarus mailing list