From 66a07eba3eb08a5cd0b154ade1b461a3398fabc5 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Tue, 26 Dec 2006 18:12:56 +0000 Subject: [PATCH] * give an error if the same method declaration is added twice to an interface/class/object (mantis 8019) git-svn-id: trunk@5721 - --- .gitattributes | 1 + compiler/nobj.pas | 12 +++++++++--- tests/webtbf/tw8019.pp | 21 +++++++++++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 tests/webtbf/tw8019.pp diff --git a/.gitattributes b/.gitattributes index 3f16960e9e..8f32ccb715 100644 --- a/.gitattributes +++ b/.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 diff --git a/compiler/nobj.pas b/compiler/nobj.pas index c3b4f3b551..5ccd994d3a 100644 --- a/compiler/nobj.pas +++ b/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; diff --git a/tests/webtbf/tw8019.pp b/tests/webtbf/tw8019.pp new file mode 100644 index 0000000000..b5e3d9a0df --- /dev/null +++ b/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.