Forráskód Böngészése

-- Zusammenführen von r46973 in ».«:
U compiler/htypechk.pas
U compiler/ncal.pas
A tests/webtbs/tw37796.pp
-- Aufzeichnung der Informationen für Zusammenführung von r46973 in ».«:
U .

git-svn-id: branches/fixes_3_2@47908 -

florian 4 éve
szülő
commit
7eeaf5d5a0
4 módosított fájl, 48 hozzáadás és 0 törlés
  1. 1 0
      .gitattributes
  2. 2 0
      compiler/htypechk.pas
  3. 7 0
      compiler/ncal.pas
  4. 38 0
      tests/webtbs/tw37796.pp

+ 1 - 0
.gitattributes

@@ -17805,6 +17805,7 @@ tests/webtbs/tw3768.pp svneol=native#text/plain
 tests/webtbs/tw3774.pp svneol=native#text/plain
 tests/webtbs/tw3774.pp svneol=native#text/plain
 tests/webtbs/tw3777.pp svneol=native#text/plain
 tests/webtbs/tw3777.pp svneol=native#text/plain
 tests/webtbs/tw3778.pp svneol=native#text/plain
 tests/webtbs/tw3778.pp svneol=native#text/plain
+tests/webtbs/tw37796.pp svneol=native#text/pascal
 tests/webtbs/tw3780.pp svneol=native#text/plain
 tests/webtbs/tw3780.pp svneol=native#text/plain
 tests/webtbs/tw37806.pp svneol=native#text/pascal
 tests/webtbs/tw37806.pp svneol=native#text/pascal
 tests/webtbs/tw3782.pp svneol=native#text/plain
 tests/webtbs/tw3782.pp svneol=native#text/plain

+ 2 - 0
compiler/htypechk.pas

@@ -1781,6 +1781,7 @@ implementation
                  mayberesettypeconvs;
                  mayberesettypeconvs;
                  exit;
                  exit;
                end;
                end;
+             arrayconstructorn,
              setconstn,
              setconstn,
              stringconstn,
              stringconstn,
              guidconstn :
              guidconstn :
@@ -2082,6 +2083,7 @@ implementation
                  (tstringdef(def_to).encoding=tstringdef(p.resultdef).encoding) then
                  (tstringdef(def_to).encoding=tstringdef(p.resultdef).encoding) then
                 eq:=te_equal
                 eq:=te_equal
             end;
             end;
+          formaldef,
           setdef :
           setdef :
             begin
             begin
               { set can also be a not yet converted array constructor }
               { set can also be a not yet converted array constructor }

+ 7 - 0
compiler/ncal.pas

@@ -1205,6 +1205,13 @@ implementation
                     (parasym.vardef.typ=setdef) then
                     (parasym.vardef.typ=setdef) then
                    inserttypeconv(left,parasym.vardef);
                    inserttypeconv(left,parasym.vardef);
 
 
+                 { if an array constructor can be a set and it is passed to
+                   a formaldef, a set must be passed, see also issue #37796 }
+                 if (left.nodetype=arrayconstructorn) and
+                    (parasym.vardef.typ=formaldef) and
+                    (arrayconstructor_can_be_set(left)) then
+                   left:=arrayconstructor_to_set(left,false);
+
                  { set some settings needed for arrayconstructor }
                  { set some settings needed for arrayconstructor }
                  if is_array_constructor(left.resultdef) then
                  if is_array_constructor(left.resultdef) then
                   begin
                   begin

+ 38 - 0
tests/webtbs/tw37796.pp

@@ -0,0 +1,38 @@
+program tformal;
+{$mode objfpc}
+
+uses
+  sysutils;
+
+type
+  TFontStyle = (
+    fsItalic,
+    fsBold,
+    fsUnderlined,
+    fsStrikeOut
+  );
+  TFontStyles = set of TFontStyle;
+
+var aFS: TFontStyles;
+
+procedure Any(const Anything);
+begin
+  aFS:=aFS+TFontStyles(Anything);
+  Writeln(IntToHex(PLongInt(@Anything)^, 8));
+end;
+
+procedure DoIt;
+begin
+  Any([fsItalic, fsBold]); //unit1.pas(31,25) Error: Variable identifier expected
+  if aFS<>[fsItalic, fsBold] then
+    halt(1);
+  Any(Cardinal([fsItalic, fsBold])); //ok
+end;
+
+begin
+  aFS:=[];
+  writeln(Cardinal(aFS));
+  DoIt;
+  writeln(Cardinal(aFS));
+  writeln('ok');
+end.