This commit is contained in:
Ivan Bondarev 2021-08-31 20:30:25 +02:00
parent 30a8bff9d1
commit 4e49061076
2 changed files with 31 additions and 0 deletions

View file

@ -0,0 +1,29 @@
var i: integer;
procedure p0(x: byte);
begin
i := x;
end;
type
t1 = partial class end;
t2 = partial class(t1) end;
t0<T> = class
x: T;
end;
t1 = partial class(t0<byte>) end;
t2 = partial class//(t1) // Если указать наследование от t1 - ошибки нет
//Ошибка: Нельзя преобразовать тип T к byte
procedure p1 := p0(x);
end;
begin
var o := new t2;
o.x := 2;
o.p1;
assert(i = 2);
end.

View file

@ -3797,6 +3797,8 @@ namespace PascalABCCompiler.TreeConverter
{
if (!(context.converted_type.IsPartial && context.converted_type.base_type != null && context.converted_type.base_type != SemanticRules.ClassBaseType))
context.converted_type.SetBaseType(SemanticRules.ClassBaseType);
else if (context.converted_type.IsPartial && context.converted_type.base_type != null)
context.converted_type.SetBaseType(context.converted_type.base_type);
}
context.converted_type.is_class = true;