This commit is contained in:
Ivan Bondarev 2021-01-10 12:32:33 +01:00
parent 2bf21fb8aa
commit 4893429c2b
2 changed files with 31 additions and 1 deletions

View file

@ -347,7 +347,14 @@ namespace SyntaxVisitors
{
if (className is template_type_name)
{
return new template_type_name(helperName, (className as template_type_name).template_args);
if (pd.proc_header.template_args != null)
{
var template_args = (className as template_type_name).template_args.Clone() as ident_list;
template_args.AddMany(pd.proc_header.template_args.idents.ToArray());
return new template_type_name(helperName, template_args);
}
else
return new template_type_name(helperName, (className as template_type_name).template_args);
}
else if (pd.proc_header.template_args != null)
{

23
TestSuite/yield5.pas Normal file
View file

@ -0,0 +1,23 @@
type
c1<T1> = class
function f1<T2>: sequence of T2;
begin
var s: T2;
var s1: T1;
yield s;
end;
end;
begin
var o := new c1<integer>;
var i: integer;
foreach var e in o.f1&<integer> do
begin
assert(e = 0);
Inc(i);
end;
assert(i = 1);
end.