pascalabcnet/TestSuite/partial_generics6.pas
Ivan Bondarev 710d9580ca #2532
2021-10-14 20:43:29 +02:00

21 lines
511 B
ObjectPascal
Raw 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.

type
t0<T> = class end;
function f0<T>(q: t0<T>) := default(T);
type
t1<T> = partial class end;
t2<T> = partial class
// Обязательно как то использовать t1<T>, именно с <T>
o: t1<T>;
end;
t1<T> = partial class(t0<t2<T>>) end;
t2<T> = partial class
//Ошибка: Нельзя преобразовать тип t2<T> к t2<T>
function f1: t2<T> := f0(default(t1<T>));
end;
begin
var o := new t2<integer>;
assert(o.f1() = nil);
end.