mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-19 09:51:50 +02:00
* nested procedures are not supported in generic methods
git-svn-id: trunk@7368 -
This commit is contained in:
parent
cbb3667d73
commit
e7ead9fc9f
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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
26
tests/webtbf/tw7752.pp
Executable 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.
|
Loading…
Reference in New Issue
Block a user