Duplicate entries in the identifier list of the GExperts Uses Clause Manager

A long time ago I added the Identifier tab to the Uses Clause Manager in GExperts. It looks like this:

In this screen shot, I filtered for TWinControl and the expert found several matching entries, the two top ones in the unit Controls.

While this looks like a bug at first (indeed I have received a bug report for it) it is in fact a feature. There are actually two declarations of TWinControl in the unit Controls. The first is in line 212, which is a forward declaration like this:

type
  TWinControl = class;

The other is in line 1243, which is the actual declaration of the class:

  TWinControl = class(TControl)
    // class declaration goes here
  end;


(Both line numbers are from Delphi 2007, they will vary in other Delphi versions.)

The expert lists them both and when the user clicks the “Open Unit” button (or presses Ctrl+O), it will then open that unit and place the cursor in the line of the declaration.

One word to the person who reported that bug: Please do not be offended that I blogged about it not being an actual bug but a feature. It is not meant to shame you. On the contrary, I am grateful that I receive good bug reports like this one. Please keep them coming!

If you’d like to discuss this blog post, you can do so in the corresponding post in the international DelphiPraxis forum.