From a7047fe990032ce583999d4dc6c3111fdd59b33b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D0=BE=D0=BD=D0=B4=D0=B0=D1=80=D0=B5=D0=B2=20=D0=98?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD?= Date: Sun, 18 Aug 2019 18:08:27 +0200 Subject: [PATCH] fix #2071 --- Compiler/Compiler.cs | 5 +++-- TestSuite/namespaces/Spacename.pas | 6 ++++++ TestSuite/use_ns_spacename.pas | 7 +++++++ 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 TestSuite/namespaces/Spacename.pas create mode 100644 TestSuite/use_ns_spacename.pas diff --git a/Compiler/Compiler.cs b/Compiler/Compiler.cs index 18fda0b9c..f31df1e39 100644 --- a/Compiler/Compiler.cs +++ b/Compiler/Compiler.cs @@ -2773,6 +2773,7 @@ namespace PascalABCCompiler } return false; } + private Dictionary IncludeNamespaces(CompilationUnit Unit) { @@ -2811,7 +2812,7 @@ namespace PascalABCCompiler } } - Dictionary namespaces = new Dictionary(); + Dictionary namespaces = new Dictionary(StringComparer.OrdinalIgnoreCase); List namespace_modules = new List(); foreach (string file in files) { @@ -3304,7 +3305,7 @@ namespace PascalABCCompiler for (int i = SyntaxUsesList.Count - 1 - CurrentUnit.InterfaceUsedUnits.Count; i >= 0; i--) { - if (IsPossibleNamespace(SyntaxUsesList[i], true)) + if (IsPossibleNamespace(SyntaxUsesList[i], true) || namespaces.ContainsKey(SyntaxUsesList[i].name.idents[0].name)) { CurrentUnit.InterfaceUsedUnits.AddElement(new TreeRealization.namespace_unit_node(GetNamespace(SyntaxUsesList[i]))); CurrentUnit.PossibleNamespaces.Add(SyntaxUsesList[i]); diff --git a/TestSuite/namespaces/Spacename.pas b/TestSuite/namespaces/Spacename.pas new file mode 100644 index 000000000..b995af963 --- /dev/null +++ b/TestSuite/namespaces/Spacename.pas @@ -0,0 +1,6 @@ +namespace Spacename; + +type TClass = class +end; + +end. \ No newline at end of file diff --git a/TestSuite/use_ns_spacename.pas b/TestSuite/use_ns_spacename.pas new file mode 100644 index 000000000..43f5b848d --- /dev/null +++ b/TestSuite/use_ns_spacename.pas @@ -0,0 +1,7 @@ +//nopabcrtl +{$includenamespace 'namespaces/Spacename.pas'} +uses Spacename; + +begin + var t: TClass; +end. \ No newline at end of file