summaryrefslogtreecommitdiff
path: root/tests/webtbf/tw24453.pp
blob: 6ab955b16960bc2a98c555b8e0e40f1578c47ab1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{ %FAIL }

unit tw24453;

{$mode delphi}{$H+}

interface

uses
  Classes, SysUtils;

type

  { TIterator }

  TIterator<T> = class
  end;

  TAncestor<T> = class
  public type
    TAncestorIterator = class(TIterator<T>)
    end;
  end;

  TTestClass<T> = class(TAncestor<T>)
  private
    // this compiler recognise
    fAncIterator: TAncestor<T>.TAncestorIterator;
  protected
    // this however does not compile, compiler error is
    // ugenericsnestedclassdeclaration.pas(29,39) Fatal: Syntax error, ";" expected but "." found
    // the same problem as with result type is  with arguments of methods aswell

    //function GetIterator: TAncestor<T>.TAncestorIterator;

    // this compile, but not compatible with delphi (at least with delphi XE2, which I am using)
    function GetIterator: TAncestorIterator<T>;
  end;

implementation

function TTestClass<T>.GetIterator: TAncestorIterator<T>;
begin
  Result := fAncIterator;
end;

end.