Sfoglia il codice sorgente

* give an error if the same method declaration is added twice to an
interface/class/object (mantis 8019)

git-svn-id: trunk@5721 -

Jonas Maebe 18 anni fa
parent
commit
66a07eba3e
3 ha cambiato i file con 31 aggiunte e 3 eliminazioni
  1. 1 0
      .gitattributes
  2. 9 3
      compiler/nobj.pas
  3. 21 0
      tests/webtbf/tw8019.pp

+ 1 - 0
.gitattributes

@@ -6993,6 +6993,7 @@ tests/webtbf/tw7322.pp svneol=native#text/plain
 tests/webtbf/tw7438.pp svneol=native#text/plain
 tests/webtbf/tw7438a.pp svneol=native#text/plain
 tests/webtbf/tw7989.pp svneol=native#text/plain
+tests/webtbf/tw8019.pp svneol=native#text/plain
 tests/webtbf/uw0744.pp svneol=native#text/plain
 tests/webtbf/uw0840a.pp svneol=native#text/plain
 tests/webtbf/uw0840b.pp svneol=native#text/plain

+ 9 - 3
compiler/nobj.pas

@@ -280,7 +280,9 @@ implementation
                       begin
                         if is_visible then
                           procdefcoll^.hidden:=true;
-                        if (_class=pd._class) and not(po_reintroduce in pd.procoptions) then
+                        if (pd._class=procdefcoll^.data._class) then
+                           MessagePos(pd.fileinfo,parser_e_overloaded_have_same_parameters)
+                        else if (_class=pd._class) and not(po_reintroduce in pd.procoptions) then
                           MessagePos1(pd.fileinfo,parser_w_should_use_override,pd.fullprocname(false));
                       end;
                   end
@@ -299,7 +301,9 @@ implementation
                           begin
                             if is_visible then
                               procdefcoll^.hidden:=true;
-                            if (_class=pd._class) and not(po_reintroduce in pd.procoptions) then
+                            if (pd._class=procdefcoll^.data._class) then
+                              MessagePos(pd.fileinfo,parser_e_overloaded_have_same_parameters)
+                            else if (_class=pd._class) and not(po_reintroduce in pd.procoptions) then
                               MessagePos1(pd.fileinfo,parser_w_should_use_override,pd.fullprocname(false));
                           end;
                       end
@@ -374,7 +378,9 @@ implementation
                         begin
                           if is_visible then
                             procdefcoll^.hidden:=true;
-                          if (_class=pd._class) and not(po_reintroduce in pd.procoptions) then
+                          if (pd._class=procdefcoll^.data._class) then
+                            MessagePos(pd.fileinfo,parser_e_overloaded_have_same_parameters)
+                          else if (_class=pd._class) and not(po_reintroduce in pd.procoptions) then
                             MessagePos1(pd.fileinfo,parser_w_should_use_override,pd.fullprocname(false));
                         end;
                      end;

+ 21 - 0
tests/webtbf/tw8019.pp

@@ -0,0 +1,21 @@
+{ %fail }
+
+{$mode delphi}
+program test2;
+
+type
+  XResult = integer;
+  XStr = integer;
+
+  PDNSEntry = ^XDNSEntry;
+  XDNSEntry =
+  record
+  end;
+
+  itest = interface(iunknown)
+    function GetHostByName(const Name: XStr; out Res: PDNSEntry): XResult;
+    function GetHostByName(const Name: XStr; out Res: XDNSEntry): XResult;
+  end;
+
+begin
+end.