diff --git a/TestSuite/where22.pas b/TestSuite/where22.pas new file mode 100644 index 000000000..d4f8820c0 --- /dev/null +++ b/TestSuite/where22.pas @@ -0,0 +1,22 @@ +type + t1 = interface + where TSelf: t1; + function f: integer; + end; + //Ошибка: Невозможно инстанцировать, так как тип TSelf не реализует интерфейс t1 + t2 = interface(t1) + where TSelf: t2; + // А если так то работает: +// where TSelf: t1, t2; + end; + + TClass = class(t2) + public function f: integer; + begin + Result := 1; + end; + end; +begin + var obj := new TClass; + assert(obj.f = 1); +end. \ No newline at end of file diff --git a/TreeConverter/TreeRealization/type_table.cs b/TreeConverter/TreeRealization/type_table.cs index a67dbbdae..5bfdedd3f 100644 --- a/TreeConverter/TreeRealization/type_table.cs +++ b/TreeConverter/TreeRealization/type_table.cs @@ -620,7 +620,7 @@ namespace PascalABCCompiler.TreeRealization if (interf_original_generic != null && interf_original_generic == base_original_generic) { // Нам нужно два original_generic as compiled_type_node и два instance_params - + //if (ctcgi != null) // по идее это всегда так! потому что cgitn - compiled - поэтому закомментировал SSM 14/02/23 // теперь надо проверить параметры на ковариантность - все var n = base_instance_params.Count; @@ -632,7 +632,7 @@ namespace PascalABCCompiler.TreeRealization if (n != n1) impl = false; else - for (int i=0; i