Explorar el Código

* only try to call procvars while choosing overloads in case they don't
require any parameters (mantis #22320)

git-svn-id: trunk@21729 -

Jonas Maebe hace 13 años
padre
commit
fdbe35aadf
Se han modificado 3 ficheros con 77 adiciones y 1 borrados
  1. 1 0
      .gitattributes
  2. 3 1
      compiler/htypechk.pas
  3. 73 0
      tests/webtbs/tw22320.pp

+ 1 - 0
.gitattributes

@@ -12663,6 +12663,7 @@ tests/webtbs/tw22154.pp svneol=native#text/pascal
 tests/webtbs/tw2220.pp svneol=native#text/plain
 tests/webtbs/tw2226.pp svneol=native#text/plain
 tests/webtbs/tw2229.pp svneol=native#text/plain
+tests/webtbs/tw22320.pp svneol=native#text/plain
 tests/webtbs/tw2233.pp svneol=native#text/plain
 tests/webtbs/tw2242.pp svneol=native#text/plain
 tests/webtbs/tw2250.pp svneol=native#text/plain

+ 3 - 1
compiler/htypechk.pas

@@ -2417,7 +2417,9 @@ implementation
                  (
                   (count=1) or
                   equal_defs(tprocvardef(currpt.left.resultdef).returndef,def_to)
-                 ) then
+                 ) and
+                 { and if it doesn't require any parameters }
+                 (tprocvardef(currpt.left.resultdef).minparacount=0)  then
                 begin
                   releasecurrpt:=true;
                   currpt:=tcallparanode(pt.getcopy);

+ 73 - 0
tests/webtbs/tw22320.pp

@@ -0,0 +1,73 @@
+program Test;
+
+{$IFDEF FPC}
+  {$MODE DELPHI}
+{$ENDIF}
+
+{$APPTYPE CONSOLE}
+
+type
+  TwbSignature = array[0..3] of AnsiChar;
+
+  TwbConflictPriority = (
+    cpIgnore,
+    cpBenign,
+    cpTranslate,
+    cpNormal,
+    cpCritical,
+    cpFormID
+  );
+
+  IwbElement = interface
+    ['{F4B4637D-C794-415F-B5C7-587EAA4095B3}']
+  end;
+
+  TwbDontShowCallback = function(const aElement: IwbElement): Boolean;
+
+  IwbSubRecordDef = interface
+    ['{D848E426-8768-45F4-B192-4DEFBE34D40A}']
+  end;
+
+  IwbByteArrayDef = interface
+    ['{3069E1AC-4307-421B-93E4-797E18075EF9}']
+  end;
+
+function wbByteArray(const aName : string = 'Unknown';
+                           aSize : Cardinal = 0;
+                           aPriority : TwbConflictPriority = cpNormal;
+                           aRequired : Boolean = False;
+                           aDontShow : TwbDontShowCallback = nil)
+                                     : IwbByteArrayDef; overload;
+begin
+  Result := nil;
+end;
+
+function wbByteArray(const aSignature : TwbSignature;
+                     const aName : string = 'Unknown';
+                           aSize : Cardinal = 0;
+                           aPriority : TwbConflictPriority = cpNormal;
+                           aRequired : Boolean = False;
+                           aSizeMatch : Boolean = False;
+                           aDontShow : TwbDontShowCallback = nil)
+                                      : IwbSubRecordDef; overload;
+begin
+  Result := nil;
+  halt(2);
+end;
+
+function wbUnknown(aPriority : TwbConflictPriority = cpNormal;
+                   aRequired : Boolean = False;
+                   aDontShow : TwbDontShowCallback = nil)
+                             : IwbByteArrayDef;
+begin
+  Result := wbByteArray('Unknown', 0, aPriority, aRequired, aDontShow);
+end;
+
+function cb(const aElement: IwbElement): Boolean;
+begin
+  halt(1);
+end;
+
+begin
+  wbUnknown(cpNormal,False,cb);
+end.