mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 23:49:05 +02:00
* function results can be a generic parameter
git-svn-id: trunk@3585 -
This commit is contained in:
parent
5240913a80
commit
e4d2d87bb9
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -6820,6 +6820,7 @@ tests/webtbs/tw5023.pp svneol=native#text/plain
|
|||||||
tests/webtbs/tw5036.pp svneol=native#text/plain
|
tests/webtbs/tw5036.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw5082.pp -text svneol=unset#text/plain
|
tests/webtbs/tw5082.pp -text svneol=unset#text/plain
|
||||||
tests/webtbs/tw6491.pp svneol=native#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/tw6684.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw6735.pp svneol=native#text/plain
|
tests/webtbs/tw6735.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw6742.pp svneol=native#text/plain
|
tests/webtbs/tw6742.pp svneol=native#text/plain
|
||||||
|
@ -896,6 +896,7 @@ implementation
|
|||||||
pd : tprocdef;
|
pd : tprocdef;
|
||||||
isclassmethod : boolean;
|
isclassmethod : boolean;
|
||||||
locationstr: string;
|
locationstr: string;
|
||||||
|
popclass : boolean;
|
||||||
begin
|
begin
|
||||||
locationstr:='';
|
locationstr:='';
|
||||||
pd:=nil;
|
pd:=nil;
|
||||||
@ -924,7 +925,18 @@ implementation
|
|||||||
if try_to_consume(_COLON) then
|
if try_to_consume(_COLON) then
|
||||||
begin
|
begin
|
||||||
inc(testcurobject);
|
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);
|
single_type(pd.rettype,false);
|
||||||
|
if popclass then
|
||||||
|
symtablestack.pop(pd._class.symtable);
|
||||||
pd.test_if_fpu_result;
|
pd.test_if_fpu_result;
|
||||||
dec(testcurobject);
|
dec(testcurobject);
|
||||||
|
|
||||||
|
22
tests/webtbs/tw6624.pp
Normal file
22
tests/webtbs/tw6624.pp
Normal 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.
|
Loading…
Reference in New Issue
Block a user