Преглед изворни кода

-- Zusammenführen von r39934 in ».«:
U compiler/defcmp.pas
U compiler/node.pas
U compiler/pexpr.pas
A tests/webtbs/tw34037.pp
-- Aufzeichnung der Informationen für Zusammenführung von r39934 in ».«:
U .

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

florian пре 4 година
родитељ
комит
f8e55c4350
5 измењених фајлова са 30 додато и 5 уклоњено
  1. 1 0
      .gitattributes
  2. 2 1
      compiler/defcmp.pas
  3. 5 3
      compiler/node.pas
  4. 1 1
      compiler/pexpr.pas
  5. 21 0
      tests/webtbs/tw34037.pp

+ 1 - 0
.gitattributes

@@ -17588,6 +17588,7 @@ tests/webtbs/tw33898.pp -text svneol=native#text/pascal
 tests/webtbs/tw33963.pp svneol=native#text/pascal
 tests/webtbs/tw33963.pp svneol=native#text/pascal
 tests/webtbs/tw3402.pp svneol=native#text/plain
 tests/webtbs/tw3402.pp svneol=native#text/plain
 tests/webtbs/tw34021.pp -text svneol=native#text/pascal
 tests/webtbs/tw34021.pp -text svneol=native#text/pascal
+tests/webtbs/tw34037.pp svneol=native#text/pascal
 tests/webtbs/tw34055.pp svneol=native#text/plain
 tests/webtbs/tw34055.pp svneol=native#text/plain
 tests/webtbs/tw3411.pp svneol=native#text/plain
 tests/webtbs/tw3411.pp svneol=native#text/plain
 tests/webtbs/tw34124.pp svneol=native#text/pascal
 tests/webtbs/tw34124.pp svneol=native#text/pascal

+ 2 - 1
compiler/defcmp.pas

@@ -289,7 +289,8 @@ implementation
              if assigned(tstoreddef(def_from).genconstraintdata) or
              if assigned(tstoreddef(def_from).genconstraintdata) or
                  assigned(tstoreddef(def_to).genconstraintdata) then
                  assigned(tstoreddef(def_to).genconstraintdata) then
                begin
                begin
-                 if def_from.typ<>def_to.typ then
+                 { constants could get another deftype (e.g. niln) }
+                 if (def_from.typ<>def_to.typ) and not(fromtreetype in nodetype_const) then
                    begin
                    begin
                      { not compatible anyway }
                      { not compatible anyway }
                      doconv:=tc_not_possible;
                      doconv:=tc_not_possible;

+ 5 - 3
compiler/node.pas

@@ -195,11 +195,13 @@ interface
           'specializen');
           'specializen');
 
 
       { a set containing all const nodes }
       { a set containing all const nodes }
-      nodetype_const = [ordconstn,
+      nodetype_const = [niln,
+                        ordconstn,
                         pointerconstn,
                         pointerconstn,
                         stringconstn,
                         stringconstn,
                         guidconstn,
                         guidconstn,
-                        realconstn];
+                        realconstn,
+                        setconstn];
 
 
     type
     type
        { all boolean field of ttree are now collected in flags }
        { all boolean field of ttree are now collected in flags }
@@ -657,7 +659,7 @@ implementation
 
 
     function is_constnode(p : tnode) : boolean;
     function is_constnode(p : tnode) : boolean;
       begin
       begin
-        is_constnode:=(p.nodetype in [niln,ordconstn,realconstn,stringconstn,setconstn,pointerconstn,guidconstn]);
+        is_constnode:=(p.nodetype in nodetype_const);
       end;
       end;
 
 
 
 

+ 1 - 1
compiler/pexpr.pas

@@ -1974,7 +1974,7 @@ implementation
                       not is_objectpascal_helper(tdef(srsymtable.defowner)) then
                       not is_objectpascal_helper(tdef(srsymtable.defowner)) then
                     internalerror(2013011401);
                     internalerror(2013011401);
                   { convert const node to temp node of the extended type }
                   { convert const node to temp node of the extended type }
-                  if node.nodetype in (nodetype_const+[niln,addrn]) then
+                  if node.nodetype in (nodetype_const+[addrn]) then
                     begin
                     begin
                       extdef:=tobjectdef(srsymtable.defowner).extendeddef;
                       extdef:=tobjectdef(srsymtable.defowner).extendeddef;
                       newstatement:=nil;
                       newstatement:=nil;

+ 21 - 0
tests/webtbs/tw34037.pp

@@ -0,0 +1,21 @@
+program project1;
+{$mode objfpc}{$H+}
+
+uses
+  Classes, FGL;
+
+type
+  TBaseClass = class (TObject)
+  end;
+
+  generic TFPGObjectListEx<T: TBaseClass> = class (specialize TFPGObjectList<T>)
+    function GetItemByID(AID: Integer): T;
+  end;
+
+function TFPGObjectListEx.GetItemByID(AID: Integer): T;
+begin
+  Result:=nil; //T(nil);
+end;
+
+begin
+end.