From 719c29cf869c473f3c2e03228338f3a41b3d9f04 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Sun, 16 Dec 2007 22:22:11 +0000 Subject: [PATCH] + new cpo_openequalisexact parameter comparison option which treats equal open arrays, open strings and arrays of const (implicitly also open) as exactly matching (since you cannot declare such types on their own, so they will never match exactly) * require that forward declared procedures match the implementation exactly for both the parameters (with the above modification) and result type (mantis #10425 and the related webtbf/tw10425a.pp) git-svn-id: trunk@9484 - --- .gitattributes | 2 ++ compiler/defcmp.pas | 14 +++++++-- compiler/pdecsub.pas | 19 ++++-------- tests/webtbf/tw10425a.pp | 27 ++++++++++++++++ tests/webtbs/tw10425.pp | 66 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 113 insertions(+), 15 deletions(-) create mode 100644 tests/webtbf/tw10425a.pp create mode 100644 tests/webtbs/tw10425.pp diff --git a/.gitattributes b/.gitattributes index 00fd05b485..234d550f91 100644 --- a/.gitattributes +++ b/.gitattributes @@ -7470,6 +7470,7 @@ tests/webtbf/tw0890a.pp svneol=native#text/plain tests/webtbf/tw0893.pp svneol=native#text/plain tests/webtbf/tw0896.pp svneol=native#text/plain tests/webtbf/tw0896a.pp svneol=native#text/plain +tests/webtbf/tw10425a.pp svneol=native#text/plain tests/webtbf/tw1157a.pp svneol=native#text/plain tests/webtbf/tw1238.pp svneol=native#text/plain tests/webtbf/tw1251a.pp svneol=native#text/plain @@ -7805,6 +7806,7 @@ tests/webtbs/tw10320.pp svneol=native#text/plain tests/webtbs/tw10350.pp svneol=native#text/plain tests/webtbs/tw10371.pp svneol=native#text/plain tests/webtbs/tw1041.pp svneol=native#text/plain +tests/webtbs/tw10425.pp svneol=native#text/plain tests/webtbs/tw1044.pp svneol=native#text/plain tests/webtbs/tw1046.pp svneol=native#text/plain tests/webtbs/tw1050.pp svneol=native#text/plain diff --git a/compiler/defcmp.pas b/compiler/defcmp.pas index 16482c478e..1de11238c6 100644 --- a/compiler/defcmp.pas +++ b/compiler/defcmp.pas @@ -34,7 +34,7 @@ interface type { if acp is cp_all the var const or nothing are considered equal } tcompare_paras_type = ( cp_none, cp_value_equal_const, cp_all,cp_procvar); - tcompare_paras_option = (cpo_allowdefaults,cpo_ignorehidden,cpo_allowconvert,cpo_comparedefaultvalue); + tcompare_paras_option = (cpo_allowdefaults,cpo_ignorehidden,cpo_allowconvert,cpo_comparedefaultvalue,cpo_openequalisexact); tcompare_paras_options = set of tcompare_paras_option; tcompare_defs_option = (cdo_internal,cdo_explicit,cdo_check_operator,cdo_allow_variant,cdo_parameter); @@ -1517,7 +1517,7 @@ implementation { both must be hidden } if (vo_is_hidden_para in currpara1.varoptions)<>(vo_is_hidden_para in currpara2.varoptions) then exit; - eq:=te_equal; + eq:=te_exact; if not(vo_is_self in currpara1.varoptions) and not(vo_is_self in currpara2.varoptions) then begin @@ -1566,6 +1566,16 @@ implementation { check type } if eq=te_incompatible then exit; + { open arrays can never match exactly, since you cannot define } + { a separate "open array" type -> we have to be able to } + { consider those as exact when resolving forward definitions. } + { The same goes for openstrings and array of const } + if (is_open_array(currpara1.vardef) or + is_array_of_const(currpara1.vardef) or + is_open_string(currpara1.vardef)) and + (eq=te_equal) and + (cpo_openequalisexact in cpoptions) then + eq:=te_exact; if eq