* function results can be a generic parameter

git-svn-id: trunk@3585 -
This commit is contained in:
florian 2006-05-19 21:54:39 +00:00
parent 5240913a80
commit e4d2d87bb9
3 changed files with 35 additions and 0 deletions

1
.gitattributes vendored
View File

@ -6820,6 +6820,7 @@ tests/webtbs/tw5023.pp svneol=native#text/plain
tests/webtbs/tw5036.pp svneol=native#text/plain
tests/webtbs/tw5082.pp -text svneol=unset#text/plain
tests/webtbs/tw6491.pp svneol=native#text/plain
tests/webtbs/tw6624.pp svneol=native#text/plain
tests/webtbs/tw6684.pp svneol=native#text/plain
tests/webtbs/tw6735.pp svneol=native#text/plain
tests/webtbs/tw6742.pp svneol=native#text/plain

View File

@ -896,6 +896,7 @@ implementation
pd : tprocdef;
isclassmethod : boolean;
locationstr: string;
popclass : boolean;
begin
locationstr:='';
pd:=nil;
@ -924,7 +925,18 @@ implementation
if try_to_consume(_COLON) then
begin
inc(testcurobject);
{ Add objectsymtable to be able to find generic type definitions }
popclass:=false;
if assigned(pd._class) and
(pd.parast.symtablelevel=normal_function_level) and
(symtablestack.top.symtabletype<>objectsymtable) then
begin
symtablestack.push(pd._class.symtable);
popclass:=true;
end;
single_type(pd.rettype,false);
if popclass then
symtablestack.pop(pd._class.symtable);
pd.test_if_fpu_result;
dec(testcurobject);

22
tests/webtbs/tw6624.pp Normal file
View File

@ -0,0 +1,22 @@
program project1;
{$mode objfpc}{$H+}
type
generic TGenTest1<T> = class
public
procedure One(const a: T);
function Two: T;
end;
procedure TGenTest1.One(const a: T);
begin
end;
function TGenTest1.Two: T; // fails here
begin
end;
begin
end.