Jump to content
Sign in to follow this  
Mike Torrettinni

Code completion and types - correct or a mess?

Recommended Posts

I noticed a difference how code completion shows types in some cases. Here I have example of difference between types for variables and arguments:

 

image.thumb.png.0ea11a007ace8368eb8f22630c6c5806.png

 

image.thumb.png.1d814e8a1b812ffc6e3097f6e2730b69.png

 

image.thumb.png.7d6cc4ed69fc58250a77623fef091f6d.png

 

Especially for TLst to shows as class(class(TObject) is quite different than TList<integer>.

 

In some of my code, that I can't replicate, the type for TArray<TRec> is shown as array of TRec. Not a big deal, I guess. 

 

I would expect in D11 that TArray and TList would resolve correctly, as defined. 

 

 

Or is this behavior correct and code completion works as expected, I just don't have the knowledge to understand it?

 

 

Test code:

program Project1;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  System.SysUtils, System.Generics.Collections;

type
  TRec = record
  end;
  TArr = TArray<TRec>;
  TArrInt = TArray<integer>;
  TLst = TList<TRec>;
  TLstInt = TList<integer>;

procedure Test(arr: TArr; lst: TLst);
begin
end;

var
    xArr: TArr;
    xArrInt: TArrInt;
    xLst: TLst;
    xLstInt: TLstInt;

begin
  //Test(
end.

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×