Sfoglia il codice sorgente

* sets with the same base/range can still have a different size (and hence
not be equal) due to different packset settings -> still need conversion
(mantis #23204)

git-svn-id: trunk@23054 -

Jonas Maebe 12 anni fa
parent
commit
c7255f153e
4 ha cambiato i file con 46 aggiunte e 3 eliminazioni
  1. 2 0
      .gitattributes
  2. 5 3
      compiler/defcmp.pas
  3. 21 0
      tests/webtbs/tw23204.pp
  4. 18 0
      tests/webtbs/uw23204.pp

+ 2 - 0
.gitattributes

@@ -12999,6 +12999,7 @@ tests/webtbs/tw2317.pp svneol=native#text/plain
 tests/webtbs/tw2318.pp svneol=native#text/plain
 tests/webtbs/tw23185.pp svneol=native#text/pascal
 tests/webtbs/tw2318b.pp svneol=native#text/plain
+tests/webtbs/tw23204.pp -text svneol=native#text/plain
 tests/webtbs/tw23212.pp svneol=native#text/plain
 tests/webtbs/tw2323.pp svneol=native#text/plain
 tests/webtbs/tw23270.pp svneol=native#text/pascal
@@ -13789,6 +13790,7 @@ tests/webtbs/uw2266b.pas svneol=native#text/plain
 tests/webtbs/uw2269.inc svneol=native#text/plain
 tests/webtbs/uw22741a.pp svneol=native#text/plain
 tests/webtbs/uw22741b.pp svneol=native#text/plain
+tests/webtbs/uw23204.pp -text svneol=native#text/plain
 tests/webtbs/uw2364.pp svneol=native#text/plain
 tests/webtbs/uw2706a.pp svneol=native#text/plain
 tests/webtbs/uw2706b.pp svneol=native#text/plain

+ 5 - 3
compiler/defcmp.pas

@@ -1376,10 +1376,12 @@ implementation
                      if assigned(tsetdef(def_from).elementdef) and
                         assigned(tsetdef(def_to).elementdef) then
                       begin
-                        { sets with the same element base type and the same range are equal }
+                        { sets with the same size (packset setting), element
+                          base type and the same range are equal }
                         if equal_defs(tsetdef(def_from).elementdef,tsetdef(def_to).elementdef) and
-                          (tsetdef(def_from).setbase=tsetdef(def_to).setbase) and
-                          (tsetdef(def_from).setmax=tsetdef(def_to).setmax) then
+                           (tsetdef(def_from).setbase=tsetdef(def_to).setbase) and
+                           (tsetdef(def_from).setmax=tsetdef(def_to).setmax) and
+                           (def_from.size=def_to.size) then
                           eq:=te_equal
                         else if is_subequal(tsetdef(def_from).elementdef,tsetdef(def_to).elementdef) then
                           begin

+ 21 - 0
tests/webtbs/tw23204.pp

@@ -0,0 +1,21 @@
+program tw23204;
+
+{$mode Delphi}{$H+}
+
+uses
+  uw23204;
+
+var
+  cur_p: TP;
+
+function DropP:TPs;
+begin
+  result := [cur_p.AType];
+end;
+
+
+begin
+  cur_p.AType:=pt_1;
+  if DropP<>[pt_1] then
+    halt(1);
+end.

+ 18 - 0
tests/webtbs/uw23204.pp

@@ -0,0 +1,18 @@
+unit uw23204;
+
+//{$mode Delphi}{$H+} // error disappears!
+{$mode objfpc}{$H+}
+
+interface
+
+type
+//  TPColor = (pc1, pc2);
+  TPType = (pt_0, pt_1);
+  TP = record
+//    AColor: TPColor;
+    AType: TPType;
+  end;
+  TPs = set of TPType;
+
+implementation
+end.