* nested procedures are not supported in generic methods

git-svn-id: trunk@7368 -
This commit is contained in:
peter 2007-05-16 20:56:00 +00:00
parent cbb3667d73
commit e7ead9fc9f
4 changed files with 32 additions and 4 deletions

1
.gitattributes vendored
View File

@ -7289,6 +7289,7 @@ tests/webtbf/tw7070.pp svneol=native#text/plain
tests/webtbf/tw7322.pp svneol=native#text/plain
tests/webtbf/tw7438.pp svneol=native#text/plain
tests/webtbf/tw7438a.pp svneol=native#text/plain
tests/webtbf/tw7752.pp svneol=native#text/plain
tests/webtbf/tw7989.pp svneol=native#text/plain
tests/webtbf/tw7998.pp svneol=native#text/plain
tests/webtbf/tw8019.pp svneol=native#text/plain

View File

@ -834,7 +834,8 @@ implementation
pd.proctypeoption:=potype;
{ methods inherit df_generic or df_specialization from the objectdef }
if assigned(pd._class) then
if assigned(pd._class) and
(pd.parast.symtablelevel=normal_function_level) then
begin
if (df_generic in pd._class.defoptions) then
include(pd.defoptions,df_generic);

View File

@ -1382,9 +1382,9 @@ implementation
if (tcgprocinfo(current_procinfo).nestedprocs.count>0) then
begin
if (df_generic in current_procinfo.procdef.defoptions) then
{$warning TODO Add error message for nested procs in generics}
internalerror(200511151)
else if (po_inline in current_procinfo.procdef.procoptions) then
Comment(V_Error,'Generic methods cannot have nested procedures')
else
if (po_inline in current_procinfo.procdef.procoptions) then
begin
Message1(parser_w_not_supported_for_inline,'nested procedures');
Message(parser_w_inlining_disabled);

26
tests/webtbf/tw7752.pp Executable file
View File

@ -0,0 +1,26 @@
{ %fail }
{$mode objfpc}
unit tw7752;
interface
type generic TMapNode<_Key,_Value> = class(TObject)
key: _Key;
value: _Value;
end;
generic TMap<_Key,_Value> = class(TObject)
private
public
procedure Insert(x: TMapNode);
end;
implementation
procedure TMap.Insert(x: TMapNode);
procedure TreeInsert(z: TMapNode);
var x,y: TMapNode;
begin
end;
begin
end;
end.