From 8f7ada0db0e970a66dd083f6aaa75a487c1ba8a3 Mon Sep 17 00:00:00 2001 From: paul Date: Sun, 9 Jan 2011 05:08:04 +0000 Subject: [PATCH] compiler: use anonymous inherited in all cases where the next token <> _ID (bug #0018443) git-svn-id: trunk@16741 - --- .gitattributes | 1 + compiler/pexpr.pas | 2 +- tests/webtbs/tw18443.pp | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 tests/webtbs/tw18443.pp diff --git a/.gitattributes b/.gitattributes index e9b73a95af..44c77d491d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -10945,6 +10945,7 @@ tests/webtbs/tw1820.pp svneol=native#text/plain tests/webtbs/tw18222.pp svneol=native#text/pascal tests/webtbs/tw1825.pp svneol=native#text/plain tests/webtbs/tw18266.pp svneol=native#text/plain +tests/webtbs/tw18443.pp svneol=native#text/pascal tests/webtbs/tw1850.pp svneol=native#text/plain tests/webtbs/tw1851.pp svneol=native#text/plain tests/webtbs/tw1856.pp svneol=native#text/plain diff --git a/compiler/pexpr.pas b/compiler/pexpr.pas index 078946029b..ad7e2b694c 100644 --- a/compiler/pexpr.pas +++ b/compiler/pexpr.pas @@ -2383,7 +2383,7 @@ implementation hclassdef:=hclassdef.childof; { if inherited; only then we need the method with the same name } - if token in endtokens then + if token <> _ID then begin hs:=current_procinfo.procdef.procsym.name; hsorg:=current_procinfo.procdef.procsym.realname; diff --git a/tests/webtbs/tw18443.pp b/tests/webtbs/tw18443.pp new file mode 100644 index 0000000000..c42c8a1f7e --- /dev/null +++ b/tests/webtbs/tw18443.pp @@ -0,0 +1,32 @@ +program tw18433; +{$mode objfpc} +type + TBase = class + function Print: String; virtual; + end; + + TDesc1 = class(TBase) + function Print: String; override; + end; + + TDesc2 = class(TBase) + function Print: String; override; + end; + +function TBase.Print: String; +begin + Result := 'Base'; +end; + +function TDesc1.Print: String; +begin + Result := inherited + '-Desc1'; +end; + +function TDesc2.Print: String; +begin + Result := inherited Print + '-Desc2'; +end; + +begin +end.