Przeglądaj źródła

compiler: allow to derive classes from a nested class type (issue #0016083)

git-svn-id: trunk@15036 -
paul 15 lat temu
rodzic
commit
1768810783
3 zmienionych plików z 25 dodań i 2 usunięć
  1. 1 0
      .gitattributes
  2. 2 2
      compiler/ptype.pas
  3. 22 0
      tests/webtbs/tw16083.pp

+ 1 - 0
.gitattributes

@@ -10319,6 +10319,7 @@ tests/webtbs/tw15909.pp svneol=native#text/plain
 tests/webtbs/tw1592.pp svneol=native#text/plain
 tests/webtbs/tw15930.pp svneol=native#text/plain
 tests/webtbs/tw16040.pp svneol=native#text/plain
+tests/webtbs/tw16083.pp svneol=native#text/plain
 tests/webtbs/tw1617.pp svneol=native#text/plain
 tests/webtbs/tw1622.pp svneol=native#text/plain
 tests/webtbs/tw1623.pp svneol=native#text/plain

+ 2 - 2
compiler/ptype.pas

@@ -458,7 +458,7 @@ implementation
                    else
                      begin
                        id_type(def,isforwarddef);
-                       { handle types inside classes for generics, e.g. TNode.TLongint }
+                       { handle types inside classes, e.g. TNode.TLongint }
                        while (token=_POINT) do
                          begin
                            if parse_generic then
@@ -466,7 +466,7 @@ implementation
                                 consume(_POINT);
                                 consume(_ID);
                              end
-                            else if ((def.typ=objectdef) and (df_specialization in def.defoptions)) then
+                            else if is_class(def) then
                               begin
                                 symtablestack.push(tobjectdef(def).symtable);
                                 consume(_POINT);

+ 22 - 0
tests/webtbs/tw16083.pp

@@ -0,0 +1,22 @@
+{ %norun }
+program tw16083;
+
+{$ifdef fpc}
+  {$mode delphi}
+{$endif}
+
+type
+  TClass1 = class
+  public type
+    TNestedClass = class
+    end;
+
+    TNestedClass2 = class(TNestedClass)
+    end;
+  end;
+
+  TClass3 = class(TClass1.TNestedClass)
+  end;
+
+begin
+end.