Codetools: cannot declare a for-in variable for an interface with an enumerator
Original Reporter info from Mantis: kluug.net @onpok
-
Reporter name: Ondrej Pokorny
Original Reporter info from Mantis: kluug.net @onpok
- Reporter name: Ondrej Pokorny
Description:
Codetools support declaring a for-in variable. Unfortunately it doesn't work for interfaces.
Steps to reproduce:
Try to declare "I" (Ctrl+Shift+C) in this program:
program Test;
{$MODE DELPHI}
type
TMyEnumerator = record
public
function GetCurrent: Pointer;
function MoveNext: Boolean;
public
property Current: Pointer read GetCurrent;
end;
IMyIntf = interface
['{0304E2C7-EB90-4DF5-9AA2-81A5AA5B7524}']
function GetEnumerator: TMyEnumerator;
end;
{ TMyEnumerator }
function TMyEnumerator.GetCurrent: Pointer;
begin
end;
function TMyEnumerator.MoveNext: Boolean;
begin
end;
var
X: IMyIntf;
begin
for I in X do
begin
end;
end.
-> you get an "Error: Can not find an enumerator for 'X'"
Additional information:
Patch attached.
Mantis conversion info:
- Mantis ID: 35290
- Version: 2.1 (SVN)