From 94f47443f0276794fdb31b08c3c26f34554b95c6 Mon Sep 17 00:00:00 2001 From: svenbarth Date: Fri, 6 Jun 2014 15:52:02 +0000 Subject: [PATCH] Mantis #25043 was fixed by partial specializations addition in revision 27861 + added test git-svn-id: trunk@27879 - --- .gitattributes | 1 + tests/webtbs/tw25043.pp | 79 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 tests/webtbs/tw25043.pp diff --git a/.gitattributes b/.gitattributes index ecf273d69b..3d7a3e722f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -13887,6 +13887,7 @@ tests/webtbs/tw25004.pp svneol=native#text/pascal tests/webtbs/tw2503.pp svneol=native#text/plain tests/webtbs/tw25030.pp svneol=native#text/pascal tests/webtbs/tw2504.pp svneol=native#text/plain +tests/webtbs/tw25043.pp svneol=native#text/pascal tests/webtbs/tw25054a.pp svneol=native#text/pascal tests/webtbs/tw25054b.pp svneol=native#text/pascal tests/webtbs/tw25059.pp svneol=native#text/pascal diff --git a/tests/webtbs/tw25043.pp b/tests/webtbs/tw25043.pp new file mode 100644 index 0000000000..de6a409511 --- /dev/null +++ b/tests/webtbs/tw25043.pp @@ -0,0 +1,79 @@ +program tw25043; + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +const + TestValue = 30061978; + +type + TDescendant = class(TObject) + public + function GetValue(): Integer; + end; + + TCollection = class(TObject) + protected + Value: E; + + function GetElements(Index: Integer): E; + + public + property Element: E read Value; + property Elements[Index: Integer]: E read GetElements; default; + end; + + TDescendantCollection = class(TCollection) + public + procedure TestValues(); + end; + +{ TDescendant } + +function TDescendant.GetValue(): Integer; +begin + Result := TestValue; +end; + +{ TDescendantCollection } + +procedure TDescendantCollection.TestValues(); +begin + if Value.GetValue() <> TestValue then + Halt(1); + + if Element.GetValue() <> TestValue then + Halt(1); + + if GetElements(0).GetValue() <> TestValue then + Halt(1); + + if Elements[0].GetValue() <> TestValue then + Halt(1); + + if Self[0].GetValue() <> TestValue then + Halt(1); +end; + +{ TCollection } + +function TCollection.GetElements(Index: Integer): E; +begin + Result := Value; +end; + +var + Collection: TDescendantCollection; + Descendant: TDescendant; + +begin + Descendant := TDescendant.Create(); + + Collection := TDescendantCollection.Create(); + Collection.Value := Descendant; + Collection.TestValues(); + Collection.Free(); + + Descendant.Free(); +end.