This commit is contained in:
parent
1e51c553fb
commit
710d9580ca
21
TestSuite/partial_generics6.pas
Normal file
21
TestSuite/partial_generics6.pas
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
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.
|
||||
|
|
@ -1026,6 +1026,10 @@ namespace PascalABCCompiler.TreeRealization
|
|||
}
|
||||
}
|
||||
|
||||
if (from.is_generic_type_instance && to.is_generic_type_instance && from.original_generic == to.original_generic && from.name == to.name
|
||||
&& from.original_generic is common_type_node && to.original_generic is common_type_node && (from.original_generic as common_type_node).comprehensive_namespace == (to.original_generic as common_type_node).comprehensive_namespace
|
||||
&& (to.original_generic as common_type_node).IsPartial && (from.original_generic as common_type_node).IsPartial)
|
||||
add_conversion(ret, TreeConverter.convertion_data_and_alghoritms.get_empty_conversion(from, to, true), from, to);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue