Selaa lähdekoodia

* fix for Mantis #27349: nested classes might also reside inside records

+ added test

git-svn-id: trunk@34714 -
svenbarth 8 vuotta sitten
vanhempi
commit
d4e573c1e3
3 muutettua tiedostoa jossa 45 lisäystä ja 1 poistoa
  1. 1 0
      .gitattributes
  2. 1 1
      compiler/symtable.pas
  3. 43 0
      tests/webtbs/tw27349.pp

+ 1 - 0
.gitattributes

@@ -15029,6 +15029,7 @@ tests/webtbs/tw27300a.pp svneol=native#text/pascal
 tests/webtbs/tw2731.pp svneol=native#text/plain
 tests/webtbs/tw27320.pp svneol=native#text/pascal
 tests/webtbs/tw27348.pp svneol=native#text/pascal
+tests/webtbs/tw27349.pp svneol=native#text/pascal
 tests/webtbs/tw2736.pp svneol=native#text/plain
 tests/webtbs/tw2737.pp svneol=native#text/plain
 tests/webtbs/tw2738.pp svneol=native#text/plain

+ 1 - 1
compiler/symtable.pas

@@ -2956,7 +2956,7 @@ implementation
                        ) or
                        (
                         assigned(contextobjdef) and
-                        (contextobjdef.owner.symtabletype in [globalsymtable,staticsymtable,ObjectSymtable]) and
+                        (contextobjdef.owner.symtabletype in [globalsymtable,staticsymtable,ObjectSymtable,recordsymtable]) and
                         (contextobjdef.owner.iscurrentunit) and
                         def_is_related(contextobjdef,symownerdef)
                        ) or

+ 43 - 0
tests/webtbs/tw27349.pp

@@ -0,0 +1,43 @@
+{ %NORUN }
+
+program tw27349;
+
+{$mode delphi}
+{.$mode objfpc}
+{.$modeswitch advancedrecords}
+
+type
+
+  C = class
+
+   type
+
+    tmyintf = class(TInterfacedObject, iinterface)
+     function _AddRef : longint; stdcall;
+    end;
+
+  end;
+
+  R = record
+
+   type
+
+    tmyintf = class(TInterfacedObject, iinterface)
+     function _AddRef : longint; stdcall;
+    end;
+
+  end;
+
+function C.tmyintf._AddRef: longint; stdcall;
+begin
+ result := inherited _AddRef; // OK
+end;
+
+function R.tmyintf._AddRef: longint; stdcall;
+begin
+ result := inherited _AddRef; // FAIL
+end;
+
+begin
+end.
+