This commit is contained in:
parent
5f379b9b46
commit
9fd8c001ce
13
TestSuite/abstract5.pas
Normal file
13
TestSuite/abstract5.pas
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
{$reference PresentationFramework.dll}
|
||||||
|
{$apptype windows}
|
||||||
|
uses System.Windows.Controls;
|
||||||
|
|
||||||
|
type
|
||||||
|
//Ошибка: Класс MyTextBox абстрактный и не может иметь атрибут sealed, потому что метод CreateRenderScope не реализован
|
||||||
|
MyTextBox = sealed class(RichTextBox)
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
new MyTextBox();
|
||||||
|
end.
|
||||||
16
TestSuite/units/u_abstract3.pas
Normal file
16
TestSuite/units/u_abstract3.pas
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
unit u_abstract3;
|
||||||
|
type
|
||||||
|
|
||||||
|
t1 = abstract class
|
||||||
|
// обязательно видимость private
|
||||||
|
private function f1: byte; abstract;
|
||||||
|
end;
|
||||||
|
t2 = class(t1)
|
||||||
|
private function f1: byte; override := 0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
// обязательно ещё 1 промежуточный тип между t2 и t4
|
||||||
|
t3 = class(t2) end;
|
||||||
|
|
||||||
|
end.
|
||||||
11
TestSuite/usesunits/use_abstract3.pas
Normal file
11
TestSuite/usesunits/use_abstract3.pas
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
uses u_abstract3;
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
// обязательно t3 - тип из другого модуля
|
||||||
|
//Ошибка: Абстрактный класс не может иметь атрибут sealed
|
||||||
|
t4 = sealed class(t3) end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
new t4;
|
||||||
|
end.
|
||||||
|
|
@ -2745,7 +2745,19 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
|
|
||||||
private void check_implement_abstract_function(common_type_node cnode, function_node meth, type_node interf)
|
private void check_implement_abstract_function(common_type_node cnode, function_node meth, type_node interf)
|
||||||
{
|
{
|
||||||
|
//if (meth.field_access_level == SemanticTree.field_access_level.fal_private)
|
||||||
|
// return;
|
||||||
List<SymbolInfo> sil = cnode.find_in_type(meth.name, cnode.Scope);
|
List<SymbolInfo> sil = cnode.find_in_type(meth.name, cnode.Scope);
|
||||||
|
if (meth.field_access_level == SemanticTree.field_access_level.fal_private)
|
||||||
|
{
|
||||||
|
var base_type = cnode.base_type;
|
||||||
|
while (base_type != null && base_type.IsAbstract)
|
||||||
|
{
|
||||||
|
base_type = base_type.base_type;
|
||||||
|
}
|
||||||
|
if (base_type != null && !base_type.IsAbstract && base_type != SystemLibrary.SystemLibrary.object_type)
|
||||||
|
return;
|
||||||
|
}
|
||||||
function_node fn = null;
|
function_node fn = null;
|
||||||
if (sil != null)
|
if (sil != null)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue