From 72d432fb96d55816cc57d0f9207eb39f7038615b Mon Sep 17 00:00:00 2001 From: Sun Serega Date: Sat, 6 Feb 2021 17:19:45 +0200 Subject: [PATCH 1/2] fix pascalabcnet/pascalabcnet#2429 --- TreeConverter/TreeConversion/compilation_context.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/TreeConverter/TreeConversion/compilation_context.cs b/TreeConverter/TreeConversion/compilation_context.cs index 937ea5c8f..a483a31a7 100644 --- a/TreeConverter/TreeConversion/compilation_context.cs +++ b/TreeConverter/TreeConversion/compilation_context.cs @@ -2249,11 +2249,7 @@ namespace PascalABCCompiler.TreeConverter tmp = tmp.TopScope; } } - if (_ctn != null && _ctn.base_generic_instance != null) - { - return _ctn.base_generic_instance.ConvertSymbolInfo(sil); - } - + // для partial-классов, наследующих от интерфейса в секции Implementation // Надо ещё добавить условия чтобы только для них. А то может найти не то что надо!!! if (sil == null && this.converted_type != null && this.converted_type.IsPartial) @@ -2261,6 +2257,11 @@ namespace PascalABCCompiler.TreeConverter sil = this.converted_namespace.scope.Find(name); } + if (_ctn != null && _ctn.base_generic_instance != null) + { + return _ctn.base_generic_instance.ConvertSymbolInfo(sil); + } + return sil; } From 9144f6211e3b613822cfc4b6a1d5595d95fcb0b1 Mon Sep 17 00:00:00 2001 From: Sun Serega Date: Sun, 7 Feb 2021 14:29:53 +0200 Subject: [PATCH 2/2] tests --- TestSuite/units/u_partial_2429.pas | 23 +++++++++++++++++++++++ TestSuite/usesunits/use_partial_2429.pas | 6 ++++++ 2 files changed, 29 insertions(+) create mode 100644 TestSuite/units/u_partial_2429.pas create mode 100644 TestSuite/usesunits/use_partial_2429.pas diff --git a/TestSuite/units/u_partial_2429.pas b/TestSuite/units/u_partial_2429.pas new file mode 100644 index 000000000..9aeac4e33 --- /dev/null +++ b/TestSuite/units/u_partial_2429.pas @@ -0,0 +1,23 @@ +unit u_partial_2429; + +interface + +type + t1 = partial class + function f1: integer; + end; + +implementation + +type + t0 = class + function f0 := 5; + end; + //Ошибка: Неизвестное имя 't1`1' + t1 = partial class(t0) + + end; + +function t1.f1 := self.f0; + +begin end. \ No newline at end of file diff --git a/TestSuite/usesunits/use_partial_2429.pas b/TestSuite/usesunits/use_partial_2429.pas new file mode 100644 index 000000000..1fc06577f --- /dev/null +++ b/TestSuite/usesunits/use_partial_2429.pas @@ -0,0 +1,6 @@ +uses u_partial_2429; + +begin + var a := new t1; + Assert(a.f1 = 5); +end. \ No newline at end of file