From 34ddecdbd3cd73feb683aaec63c94aa411a07f29 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, 20 Sep 2020 15:08:55 +0200 Subject: [PATCH] fix #2307 --- Compiler/PCU/PCUWriter.cs | 6 ++++++ TestSuite/CompilationSamples/u5.pas | 11 +++++++++++ TestSuite/CompilationSamples/u6.pas | 10 ++++++++++ TestSuite/CompilationSamples/u7.pas | 8 ++++++++ 4 files changed, 35 insertions(+) create mode 100644 TestSuite/CompilationSamples/u5.pas create mode 100644 TestSuite/CompilationSamples/u6.pas create mode 100644 TestSuite/CompilationSamples/u7.pas diff --git a/Compiler/PCU/PCUWriter.cs b/Compiler/PCU/PCUWriter.cs index db55758fe..d0a3353d0 100644 --- a/Compiler/PCU/PCUWriter.cs +++ b/Compiler/PCU/PCUWriter.cs @@ -883,6 +883,8 @@ namespace PascalABCCompiler.PCU unit.ImplementationUsedUnits.AddElement(comp_cnn.cont_unit); ns_dict[comp_cnn] = true; } + if (tn.base_type is common_type_node) + AddIndirectUsedUnitsForType(tn.base_type, ns_dict, interf); } } @@ -931,6 +933,8 @@ namespace PascalABCCompiler.PCU common_namespace_node cnn = cun.namespaces[0]; foreach (common_type_node ctn in cnn.types) { + if (ctn.base_type != null) + AddIndirectUsedUnitsForType(ctn.base_type, interf_ns_dict, true); foreach (common_method_node cmn in ctn.methods) { if (cmn.is_constructor && cmn.function_code != null && cmn.function_code.location == null) @@ -979,6 +983,8 @@ namespace PascalABCCompiler.PCU common_namespace_node cnn = cun.namespaces[1]; foreach (common_type_node ctn in cnn.types) { + if (ctn.base_type != null) + AddIndirectUsedUnitsForType(ctn.base_type, impl_ns_dict, true); foreach (common_method_node cmn in ctn.methods) { if (cmn.is_constructor && cmn.function_code != null && cmn.function_code.location == null) diff --git a/TestSuite/CompilationSamples/u5.pas b/TestSuite/CompilationSamples/u5.pas new file mode 100644 index 000000000..d6ce4cc00 --- /dev/null +++ b/TestSuite/CompilationSamples/u5.pas @@ -0,0 +1,11 @@ +unit u5; + +uses u7; + +procedure p1; +begin + var a: t2; + a.p0; +end; + +end. \ No newline at end of file diff --git a/TestSuite/CompilationSamples/u6.pas b/TestSuite/CompilationSamples/u6.pas new file mode 100644 index 000000000..d01ae6204 --- /dev/null +++ b/TestSuite/CompilationSamples/u6.pas @@ -0,0 +1,10 @@ +unit u6; + +type + t1 = class + + public procedure p0 := exit; + + end; + +end. \ No newline at end of file diff --git a/TestSuite/CompilationSamples/u7.pas b/TestSuite/CompilationSamples/u7.pas new file mode 100644 index 000000000..d17d3e105 --- /dev/null +++ b/TestSuite/CompilationSamples/u7.pas @@ -0,0 +1,8 @@ +unit u7; + +uses u6; + +type + t2 = class(t1) end; + +end. \ No newline at end of file