Browse Source

* fix for Mantis #38310: ignore procsyms that have no procdefs for checking overloads, or more precisely to stop checking for overloads; these are generic dummy symbols
+ added (simplified) tests

git-svn-id: trunk@48088 -

svenbarth 4 years ago
parent
commit
57d9884d96
5 changed files with 45 additions and 3 deletions
  1. 3 0
      .gitattributes
  2. 6 3
      compiler/htypechk.pas
  3. 12 0
      tests/webtbs/tw38310a.pp
  4. 12 0
      tests/webtbs/tw38310b.pp
  5. 12 0
      tests/webtbs/tw38310c.pp

+ 3 - 0
.gitattributes

@@ -18632,6 +18632,9 @@ tests/webtbs/tw3827.pp svneol=native#text/plain
 tests/webtbs/tw3829.pp svneol=native#text/plain
 tests/webtbs/tw38295.pp svneol=native#text/pascal
 tests/webtbs/tw38299.pp svneol=native#text/pascal
+tests/webtbs/tw38310a.pp svneol=native#text/pascal
+tests/webtbs/tw38310b.pp svneol=native#text/pascal
+tests/webtbs/tw38310c.pp svneol=native#text/pascal
 tests/webtbs/tw3833.pp svneol=native#text/plain
 tests/webtbs/tw3840.pp svneol=native#text/plain
 tests/webtbs/tw3841.pp svneol=native#text/plain

+ 6 - 3
compiler/htypechk.pas

@@ -2299,7 +2299,8 @@ implementation
               srsym:=tsym(helperdef.symtable.FindWithHash(hashedid));
               if assigned(srsym) and
                   { Delphi allows hiding a property by a procedure with the same name }
-                  (srsym.typ=procsym) then
+                  (srsym.typ=procsym) and
+                  (tprocsym(srsym).procdeflist.count>0) then
                 begin
                   hasoverload:=processprocsym(tprocsym(srsym),foundanything);
                   { when there is no explicit overload we stop searching }
@@ -2388,7 +2389,8 @@ implementation
                srsym:=tprocsym(tabstractrecorddef(tobjectdef(structdef).extendeddef).symtable.FindWithHash(hashedid));
                if assigned(srsym) and
                   { Delphi allows hiding a property by a procedure with the same name }
-                  (srsym.typ=procsym) then
+                  (srsym.typ=procsym) and
+                  (tprocsym(srsym).procdeflist.count>0) then
                  begin
                    hasoverload:=processprocsym(tprocsym(srsym),foundanything);
                    { when there is no explicit overload we stop searching }
@@ -2463,7 +2465,8 @@ implementation
               begin
                 srsym:=tsym(srsymtable.FindWithHash(hashedid));
                 if assigned(srsym) and
-                   (srsym.typ=procsym) then
+                   (srsym.typ=procsym) and
+                   (tprocsym(srsym).procdeflist.count>0) then
                   begin
                     { add all definitions }
                     hasoverload:=false;

+ 12 - 0
tests/webtbs/tw38310a.pp

@@ -0,0 +1,12 @@
+{ %NORUN }
+
+program tw38310a;
+
+{$mode objfpc}{$H+}
+
+uses
+  SysUtils, StrUtils, Math;
+
+begin
+  IfThen(true, 'A', IfThen(true, 'B', 'C'));
+end.

+ 12 - 0
tests/webtbs/tw38310b.pp

@@ -0,0 +1,12 @@
+{ %NORUN }
+
+program tw38310b;
+
+{$mode objfpc}{$H+}
+
+uses
+  StrUtils, SysUtils, Math;
+
+begin
+  IfThen(true, 'A', IfThen(true, 'B', 'C'));
+end.

+ 12 - 0
tests/webtbs/tw38310c.pp

@@ -0,0 +1,12 @@
+{ %NORUN }
+
+program tw38310c;
+
+{$mode objfpc}{$H+}
+
+uses
+  StrUtils, Math, SysUtils;
+
+begin
+  IfThen(true, 'A', IfThen(true, 'B', 'C'));
+end.