Ver código fonte

* fully compare typenodes and rttinodes in their docompare() methods
(mantis #21551)

git-svn-id: trunk@20630 -

Jonas Maebe 13 anos atrás
pai
commit
26754a3f9f
3 arquivos alterados com 26 adições e 2 exclusões
  1. 1 0
      .gitattributes
  2. 6 2
      compiler/nld.pas
  3. 19 0
      tests/webtbs/tw21551.pp

+ 1 - 0
.gitattributes

@@ -12297,6 +12297,7 @@ tests/webtbs/tw2131.pp svneol=native#text/plain
 tests/webtbs/tw21443.pp svneol=native#text/plain
 tests/webtbs/tw2145.pp svneol=native#text/plain
 tests/webtbs/tw21472.pp svneol=native#text/pascal
+tests/webtbs/tw21551.pp svneol=native#text/plain
 tests/webtbs/tw2158.pp svneol=native#text/plain
 tests/webtbs/tw2159.pp svneol=native#text/plain
 tests/webtbs/tw2163.pp svneol=native#text/plain

+ 6 - 2
compiler/nld.pas

@@ -1185,7 +1185,10 @@ implementation
     function ttypenode.docompare(p: tnode): boolean;
       begin
         docompare :=
-          inherited docompare(p);
+          inherited docompare(p) and
+          (typedef=ttypenode(p).typedef) and
+          (allowed=ttypenode(p).allowed) and
+          (helperallowed=ttypenode(p).helperallowed);
       end;
 
 
@@ -1267,7 +1270,8 @@ implementation
         docompare :=
           inherited docompare(p) and
           (rttidef = trttinode(p).rttidef) and
-          (rttitype = trttinode(p).rttitype);
+          (rttitype = trttinode(p).rttitype) and
+          (rttidatatype = trttinode(p).rttidatatype);
       end;
 
 end.

+ 19 - 0
tests/webtbs/tw21551.pp

@@ -0,0 +1,19 @@
+{ %opt=-O2 }
+{$mode delphi}
+
+type
+  tc1 = class
+  end;
+
+  tc2 = class
+  end;
+
+var
+  c: tobject;
+begin
+  c:=tc2.create;
+  if (c is tc1) or
+     (c is tc2) then
+    halt(0);
+  halt(1);
+end.