From f3963172bae73e5543834b3b299dbd488f6711cb Mon Sep 17 00:00:00 2001 From: paul Date: Mon, 23 Sep 2013 09:22:47 +0000 Subject: [PATCH] compiler: don't look at unit and namespace symbols from other units while searching for a type (issue #0025054) git-svn-id: trunk@25536 - --- .gitattributes | 6 ++++++ compiler/symtable.pas | 1 + tests/webtbs/Integer.ns.pp | 7 +++++++ tests/webtbs/Integer.pp | 7 +++++++ tests/webtbs/tw25054a.pp | 10 ++++++++++ tests/webtbs/tw25054b.pp | 10 ++++++++++ tests/webtbs/uw25054a.pp | 10 ++++++++++ tests/webtbs/uw25054b.pp | 10 ++++++++++ 8 files changed, 61 insertions(+) create mode 100644 tests/webtbs/Integer.ns.pp create mode 100644 tests/webtbs/Integer.pp create mode 100644 tests/webtbs/tw25054a.pp create mode 100644 tests/webtbs/tw25054b.pp create mode 100644 tests/webtbs/uw25054a.pp create mode 100644 tests/webtbs/uw25054b.pp diff --git a/.gitattributes b/.gitattributes index 97f41bf081..328580f8ab 100644 --- a/.gitattributes +++ b/.gitattributes @@ -12661,6 +12661,8 @@ tests/webtbf/uw4103.pp svneol=native#text/plain tests/webtbf/uw6922.pp svneol=native#text/plain tests/webtbf/uw8738a.pas svneol=native#text/plain tests/webtbf/uw8738b.pas svneol=native#text/plain +tests/webtbs/Integer.ns.pp svneol=native#text/pascal +tests/webtbs/Integer.pp svneol=native#text/pascal tests/webtbs/tu2002.pp svneol=native#text/plain tests/webtbs/tw0555.pp svneol=native#text/plain tests/webtbs/tw0630.pp svneol=native#text/plain @@ -13589,6 +13591,8 @@ tests/webtbs/tw25004.pp svneol=native#text/pascal tests/webtbs/tw2503.pp svneol=native#text/plain tests/webtbs/tw25030.pp svneol=native#text/pascal tests/webtbs/tw2504.pp svneol=native#text/plain +tests/webtbs/tw25054a.pp svneol=native#text/pascal +tests/webtbs/tw25054b.pp svneol=native#text/pascal tests/webtbs/tw2514.pp svneol=native#text/plain tests/webtbs/tw2525.pp svneol=native#text/plain tests/webtbs/tw2536.pp svneol=native#text/plain @@ -14361,6 +14365,8 @@ tests/webtbs/uw22741a.pp svneol=native#text/plain tests/webtbs/uw22741b.pp svneol=native#text/plain tests/webtbs/uw23204.pp svneol=native#text/plain tests/webtbs/uw2364.pp svneol=native#text/plain +tests/webtbs/uw25054a.pp svneol=native#text/pascal +tests/webtbs/uw25054b.pp svneol=native#text/pascal tests/webtbs/uw2706a.pp svneol=native#text/plain tests/webtbs/uw2706b.pp svneol=native#text/plain tests/webtbs/uw2731.pp svneol=native#text/plain diff --git a/compiler/symtable.pas b/compiler/symtable.pas index cd1ba82683..83e6e43dbe 100644 --- a/compiler/symtable.pas +++ b/compiler/symtable.pas @@ -2444,6 +2444,7 @@ implementation begin srsym:=tsym(srsymtable.FindWithHash(hashedid)); if assigned(srsym) and + (not(srsym.typ in [unitsym,namespacesym]) or srsymtable.iscurrentunit) and not(srsym.typ in [fieldvarsym,paravarsym,propertysym,procsym,labelsym]) and (not (srsym.owner.symtabletype in [objectsymtable,recordsymtable]) or is_visible_for_object(srsym,current_structdef)) then begin diff --git a/tests/webtbs/Integer.ns.pp b/tests/webtbs/Integer.ns.pp new file mode 100644 index 0000000000..c4789e2728 --- /dev/null +++ b/tests/webtbs/Integer.ns.pp @@ -0,0 +1,7 @@ +unit Integer.ns; + +interface + +implementation + +end. \ No newline at end of file diff --git a/tests/webtbs/Integer.pp b/tests/webtbs/Integer.pp new file mode 100644 index 0000000000..38f73b30d8 --- /dev/null +++ b/tests/webtbs/Integer.pp @@ -0,0 +1,7 @@ +unit Integer; + +interface + +implementation + +end. \ No newline at end of file diff --git a/tests/webtbs/tw25054a.pp b/tests/webtbs/tw25054a.pp new file mode 100644 index 0000000000..5fc6219c8f --- /dev/null +++ b/tests/webtbs/tw25054a.pp @@ -0,0 +1,10 @@ +program tw25054a; + +uses + uw25054a; + +var + X: Integer; + +begin +end. \ No newline at end of file diff --git a/tests/webtbs/tw25054b.pp b/tests/webtbs/tw25054b.pp new file mode 100644 index 0000000000..eb921c986f --- /dev/null +++ b/tests/webtbs/tw25054b.pp @@ -0,0 +1,10 @@ +program tw25054b; + +uses + uw25054b; + +var + X: Integer; + +begin +end. \ No newline at end of file diff --git a/tests/webtbs/uw25054a.pp b/tests/webtbs/uw25054a.pp new file mode 100644 index 0000000000..53daaa39f4 --- /dev/null +++ b/tests/webtbs/uw25054a.pp @@ -0,0 +1,10 @@ +unit uw25054a; + +interface + +uses + Integer.ns; + +implementation + +end. \ No newline at end of file diff --git a/tests/webtbs/uw25054b.pp b/tests/webtbs/uw25054b.pp new file mode 100644 index 0000000000..118318105d --- /dev/null +++ b/tests/webtbs/uw25054b.pp @@ -0,0 +1,10 @@ +unit uw25054b; + +interface + +uses + Integer; + +implementation + +end. \ No newline at end of file