pascalabcnet/TestSuite/partial_generics3.pas
Ivan Bondarev 72a49dc833 #2524
#2510
2021-10-05 20:45:56 +02:00

27 lines
619 B
ObjectPascal
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var i: integer;
type
t1<T> = class
procedure p0;
begin
i := 1;
end;
end;
// Обязательно промежуточный класс между t1 и t3
t2<T> = partial class(t1<T>) end;
// Обязательно t3 НЕ шаблонный
t3 = partial class(t2<byte>)
end;
// Обязательно объявить t2 и t3 дважды
t2<T> = partial class(t1<T>) end;
t3 = partial class(t2<byte>)
// Обязательно вызвать p0 из второго тела t3
procedure p1 := self.p0;
end;
begin
t3.Create.p1;
assert(i = 1);
end.