fix #2736
This commit is contained in:
parent
9721cf3c67
commit
0e3a3c232e
22
TestSuite/where22.pas
Normal file
22
TestSuite/where22.pas
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
type
|
||||||
|
t1<TSelf> = interface
|
||||||
|
where TSelf: t1<TSelf>;
|
||||||
|
function f: integer;
|
||||||
|
end;
|
||||||
|
//Ошибка: Невозможно инстанцировать, так как тип TSelf не реализует интерфейс t1<TSelf>
|
||||||
|
t2<TSelf> = interface(t1<TSelf>)
|
||||||
|
where TSelf: t2<TSelf>;
|
||||||
|
// А если так то работает:
|
||||||
|
// where TSelf: t1<TSelf>, t2<TSelf>;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TClass = class(t2<TClass>)
|
||||||
|
public function f: integer;
|
||||||
|
begin
|
||||||
|
Result := 1;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
begin
|
||||||
|
var obj := new TClass;
|
||||||
|
assert(obj.f = 1);
|
||||||
|
end.
|
||||||
|
|
@ -665,6 +665,17 @@ namespace PascalABCCompiler.TreeRealization
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (interf is common_generic_instance_type_node cictn && base_class is common_generic_instance_type_node cbctn)
|
||||||
|
{
|
||||||
|
foreach (type_node impltn in cictn.ImplementingInterfaces)
|
||||||
|
{
|
||||||
|
if (is_type_or_original_generics_equal(impltn, cbctn))
|
||||||
|
{
|
||||||
|
implements = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (interf is compiled_type_node ictn && base_class is compiled_type_node bctn)
|
else if (interf is compiled_type_node ictn && base_class is compiled_type_node bctn)
|
||||||
{
|
{
|
||||||
if (ictn.compiled_type.AssemblyQualifiedName != null && ictn.compiled_type.AssemblyQualifiedName == bctn.compiled_type.AssemblyQualifiedName)
|
if (ictn.compiled_type.AssemblyQualifiedName != null && ictn.compiled_type.AssemblyQualifiedName == bctn.compiled_type.AssemblyQualifiedName)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue