compiler:

- don't find MoveNext functions with the required arguments
  - add some test from Alexander S. Klenin
(issue #0014990)

git-svn-id: trunk@14044 -
This commit is contained in:
paul 2009-11-04 13:21:10 +00:00
parent 5f7bc2d3b5
commit 2f0cde4625
4 changed files with 35 additions and 0 deletions

1
.gitattributes vendored
View File

@ -8240,6 +8240,7 @@ tests/test/tforin19.pp svneol=native#text/pascal
tests/test/tforin2.pp svneol=native#text/pascal
tests/test/tforin20.pp svneol=native#text/pascal
tests/test/tforin21.pp svneol=native#text/pascal
tests/test/tforin22.pp svneol=native#text/pascal
tests/test/tforin3.pp svneol=native#text/pascal
tests/test/tforin4.pp svneol=native#text/pascal
tests/test/tforin5.pp svneol=native#text/pascal

View File

@ -584,6 +584,8 @@ begin
if movenext = nil then
begin
result:=cerrornode.create;
hloopvar.free;
hloopbody.free;
Message1(sym_e_no_enumerator_move,pd.returndef.GetTypeName);
end
else
@ -592,6 +594,8 @@ begin
if current = nil then
begin
result:=cerrornode.create;
hloopvar.free;
hloopbody.free;
Message1(sym_e_no_enumerator_current,pd.returndef.GetTypeName);
end
else
@ -607,6 +611,8 @@ begin
else
begin
result:=cerrornode.create;
hloopvar.free;
hloopbody.free;
Message1(sym_e_no_enumerator,expr.resultdef.GetTypeName);
end;
end;

View File

@ -4334,6 +4334,7 @@ implementation
pd := tprocdef(Tprocsym(sym).ProcdefList[i]);
if (pd.proctypeoption = potype_function) and
is_boolean(pd.returndef) and
(pd.minparacount = 0) and
(pd.visibility >= vis_public) then
begin
result:=pd;

27
tests/test/tforin22.pp Normal file
View File

@ -0,0 +1,27 @@
{ %FAIL}
{$mode objfpc}
{$apptype console}
type
T = class
F: Integer;
function MoveNext(a: Integer): Boolean;
property Current: Integer read F;
end;
function T.MoveNext(a: Integer): Boolean;
begin
Result := true;
end;
operator enumerator(a: Integer): T;
begin
Result := T.Create;
Result.F := a;
end;
var
i: Integer;
begin
for i in 1 do Writeln(i);
end.