View Issue Details

IDProjectCategoryView StatusLast Update
0038367LazarusIDEpublic2021-04-22 12:42
ReporterMichl Assigned ToPascal Riekenberg  
PrioritynormalSeverityminorReproducibilityalways
Status confirmedResolutionopen 
Product Version2.1 (SVN) 
Summary0038367: Codetools can't create local variable for specialized list
DescriptionCodetools can't create local variable for specialized list:

procedure TFooList.DoBar;
begin
  for LFoo in Self do;
end;

In that code place cursor in front of LFoo and press Ctrl + Shift + C. I get the message "project1.lpr(23,15) Error: Term has no simple type"

I would expect autocompletion to:

procedure TFooList.DoBar;
var
  LFoo: Integer;
begin
  for LFoo in Self do;
end;
Steps To ReproduceCopy&Paste following code into a simple program and try:

program Project1;

{$mode objfpc}{$H+}

uses
  fgl;

type

  TFoo = Integer;

  { TFooList }

  TFooList = class(specialize TFPGList<TFoo>)
  public
    procedure DoBar;
  end;

{ TFooList }

procedure TFooList.DoBar;
begin
  for LFoo in Self do; // place cursor here in front of LFoo and press Ctrl + Shift + C
end;

begin
end.
TagsNo tags attached.
Fixed in Revision
LazTarget-
Widgetset
Attached Files

Activities

Pascal Riekenberg

2021-04-22 12:42

developer   ~0130511

If you use Generic.Collections it works:

program Project1;

{$mode objfpc}{$H+}

uses
  Generics.Collections;

type

  TFoo = Integer;

  { TFooList }

  TFooList = class(specialize TList<TFoo>)
  public
    procedure DoBar;
  end;

{ TFooList }

procedure TFooList.DoBar;
var
  LFoo: TFoo;
begin
  for LFoo in Self do; // place cursor here in front of LFoo and press Ctrl + Shift + C
end;

begin
end.


I'll have a look at it.

Issue History

Date Modified Username Field Change
2021-01-17 23:43 Michl New Issue
2021-01-17 23:43 Michl Status new => assigned
2021-01-17 23:43 Michl Assigned To => Pascal Riekenberg
2021-04-22 12:37 Pascal Riekenberg Status assigned => confirmed
2021-04-22 12:37 Pascal Riekenberg LazTarget => -
2021-04-22 12:42 Pascal Riekenberg Note Added: 0130511