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 diff --git a/TreeConverter/TreeConversion/compilation_context.cs b/TreeConverter/TreeConversion/compilation_context.cs index 086d60a28..40f6690b1 100644 --- a/TreeConverter/TreeConversion/compilation_context.cs +++ b/TreeConverter/TreeConversion/compilation_context.cs @@ -2251,11 +2251,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) @@ -2263,6 +2259,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; }