This commit is contained in:
parent
30a8bff9d1
commit
4e49061076
29
TestSuite/partial_generics2.pas
Normal file
29
TestSuite/partial_generics2.pas
Normal 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.
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue